Important C Programs

B.Tech 1st Year Students & Freshers — Exam and Interview Preparation

Practice-oriented collection covering C fundamentals, logic building, arrays, strings, pointers, recursion and basic data structures.

B.Tech 1st Year Freshers Coding Interviews Exam Preparation

⭐ Top 30 Programs for Freshers

If you are starting interview preparation, practice these first.

#ProgramPriority
1Even or Odd⭐⭐⭐
2Largest of 3 Numbers⭐⭐⭐
3Factorial⭐⭐⭐
4Prime Number⭐⭐⭐
5Fibonacci Series⭐⭐⭐
6Reverse a Number⭐⭐⭐
7Palindrome Number⭐⭐⭐
8Armstrong Number⭐⭐⭐
9Sum of Digits⭐⭐⭐
10Count Digits⭐⭐⭐
11GCD / HCF⭐⭐⭐
12LCM⭐⭐⭐
13Prime Numbers in a Range⭐⭐⭐
14Number Patterns⭐⭐⭐
15Array Maximum / Minimum⭐⭐⭐
16Second Largest Array Element⭐⭐⭐
17Reverse an Array⭐⭐⭐
18Linear Search⭐⭐⭐
19Binary Search⭐⭐⭐
20Bubble Sort⭐⭐⭐
21Remove Duplicates⭐⭐⭐
22Missing Number⭐⭐⭐
23Reverse String⭐⭐⭐
24String Palindrome⭐⭐⭐
25Character Frequency⭐⭐⭐
26Anagram⭐⭐⭐
27Swap Using Pointers⭐⭐⭐
28Factorial Using Recursion⭐⭐⭐
29Matrix Multiplication⭐⭐⭐
30Student Structure⭐⭐⭐

1. Basic C Programs

1. Hello World
2. Read and display student details
3. Add, subtract, multiply and divide two numbers
4. Swap two numbers using a third variable
5. Swap two numbers without a third variable
6. Find ASCII value of a character
7. Convert Celsius to Fahrenheit
8. Calculate simple interest
9. Calculate area of circle, rectangle and triangle
10. Find quotient and remainder
11. Check whether a number is positive, negative or zero

2. If-Else / Decision-Making Programs

11. Check whether a number is even or odd
12. Find largest of two numbers
13. Find largest of three numbers
14. Find smallest of three numbers
15. Check whether a year is a leap year
16. Check whether a character is vowel or consonant
17. Check whether a character is alphabet, digit or special character
18. Check whether a person is eligible to vote
19. Calculate grade based on marks
20. Build a simple calculator using switch

3. Loop-Based Programs ⭐

These programs are especially useful for developing programming logic and preparing for fresher coding rounds.

21. Print numbers from 1 to N
22. Print numbers from N to 1
23. Print even numbers from 1 to N
24. Print odd numbers from 1 to N
25. Find sum of first N natural numbers
26. Find sum of even numbers
27. Find sum of odd numbers
28. Generate multiplication table
29. Calculate factorial
30. Count number of digits
31. Find sum of digits
32. Reverse a number
33. Find first and last digit
34. Find largest digit in a number
35. Find smallest digit in a number
36. Check whether a number is palindrome
37. Check whether a number is Armstrong
38. Check whether a number is perfect number
39. Check whether a number is strong number
40. Check whether a number is prime
41. Print prime numbers between two numbers
42. Find GCD/HCF
43. Find LCM
44. Generate Fibonacci series
45. Find power of a number

4. Number & Star Patterns ⭐⭐⭐

46. Right triangle star pattern
47. Inverted triangle star pattern
48. Number triangle: 1 / 12 / 123 ...
49. Repeated-number triangle: 1 / 22 / 333 ...
50. Pyramid star pattern
51. Floyd's Triangle
52. Pascal's Triangle

Example: Star Triangle

*
**
***
****
*****

Example: Floyd's Triangle

1
2 3
4 5 6
7 8 9 10

5. Array Programs ⭐⭐⭐

53. Read and print array elements
54. Find sum of array elements
55. Find average of array elements
56. Find maximum element
57. Find minimum element
58. Find second largest element
59. Find second smallest element
60. Reverse an array
61. Copy one array into another
62. Count even and odd elements
63. Count positive and negative elements
64. Linear search
65. Binary search
66. Bubble sort
67. Selection sort
68. Insertion sort
69. Merge two arrays
70. Remove duplicate elements
71. Find duplicate elements
72. Find frequency of each element
73. Find missing number in an array
74. Find common elements between two arrays
75. Find union of two arrays
76. Find intersection of two arrays
77. Rotate array left
78. Rotate array right

6. String Programs ⭐⭐⭐

79. Find length of a string
80. Copy one string to another
81. Compare two strings
82. Concatenate two strings
83. Reverse a string
84. Check whether a string is palindrome
85. Count vowels and consonants
86. Count digits and special characters
87. Count words in a string
88. Count spaces
89. Convert lowercase to uppercase
90. Convert uppercase to lowercase
91. Count frequency of each character
92. Find duplicate characters
93. Remove duplicate characters
94. Remove spaces from a string
95. Find first non-repeated character
96. Find first repeated character
97. Check whether two strings are anagrams
98. Sort characters in a string
99. Reverse words in a sentence
100. Find longest word in a sentence
Example: Input: I Love Java → Output: Java Love I

7. Functions

101. Function to find factorial
102. Function to check prime number
103. Function to check palindrome
104. Function to calculate Fibonacci
105. Function to find maximum of three numbers
106. Function to calculate GCD
107. Function to calculate LCM
108. Function to reverse a number
109. Function to calculate power
110. Function to perform calculator operations

Important Function Concepts

Function declaration
Function definition
Function arguments
Return values
Call by value
Call by reference
return_type function_name(parameters)
{
    /* statements */
}

8. Recursion ⭐⭐⭐

111. Factorial using recursion
112. Fibonacci using recursion
113. Sum of N numbers using recursion
114. Reverse a number using recursion
115. Calculate power using recursion
116. GCD using recursion
117. Binary search using recursion
118. Sum of digits using recursion
119. Check palindrome using recursion
120. Tower of Hanoi

9. Pointer Programs ⭐⭐⭐

121. Demonstrate pointer basics
122. Access variable using pointer
123. Swap two numbers using pointers
124. Find array elements using pointers
125. Traverse array using pointers
126. String manipulation using pointers
127. Pointer to pointer
128. Pointer arithmetic
129. Function pointer basics
130. Pass pointer to a function
131. Dynamic memory allocation using malloc
132. Dynamic memory allocation using calloc
133. Resize memory using realloc
134. Release memory using free

Basic Pointer Example

int a = 10;
int *p = &a;

printf("%d", *p);

Output: 10

10. Matrix Programs ⭐⭐⭐

135. Read and display matrix
136. Add two matrices
137. Subtract two matrices
138. Multiply two matrices
139. Transpose a matrix
140. Find diagonal elements
141. Find sum of diagonal elements
142. Find upper triangular matrix
143. Find lower triangular matrix
144. Check identity matrix
145. Check symmetric matrix
146. Find largest element in matrix
147. Find smallest element in matrix
148. Count zero elements
149. Find row-wise sum
150. Find column-wise sum

11. Structure Programs

151. Store student information using structure
152. Store employee information
153. Array of structures
154. Nested structures
155. Structure passed to function
156. Pointer to structure
157. Find student with highest marks
158. Sort students based on marks
159. Search employee by ID
struct Student {
    int id;
    char name[50];
    float marks;
};

12. File Handling ⭐⭐

160. Create a file
161. Write data to a file
162. Read data from a file
163. Append data to a file
164. Count characters in a file
165. Count words in a file
166. Count lines in a file
167. Copy contents from one file to another

Important File Functions

fopen()
fclose()
fprintf()
fscanf()
fgets()
fputs()
fread()
fwrite()

13. Dynamic Memory Programs

168. Dynamic array using malloc()
169. Dynamic array using calloc()
170. Resize array using realloc()
171. Free allocated memory
172. Dynamically allocate structure
173. Dynamically allocate 2D array

14. Basic Data Structure Programs ⭐⭐⭐

174. Stack using array
175. Queue using array
176. Circular queue
177. Linked list creation
178. Insert node at beginning
179. Insert node at end
180. Insert node at specific position
181. Delete node
182. Search linked list
183. Reverse linked list
184. Count linked-list nodes
185. Find middle node
186. Detect loop in linked list
187. Binary tree traversal
188. Inorder traversal
189. Preorder traversal
190. Postorder traversal

Interview Preparation Focus

For fresher interviews, concentrate on these areas:

Loops
Number problems, digit problems and patterns.
Arrays
Searching, sorting, duplicates and missing values.
Strings
Palindrome, anagram, frequency and word manipulation.
Pointers
Addresses, dereferencing, pointer arithmetic and functions.
Recursion
Factorial, Fibonacci, search and mathematical problems.
Data Structures
Stack, queue and linked-list fundamentals.
Interview tip: Do not just memorize programs. Be able to explain the approach, dry-run the logic, identify edge cases and write the program without looking at the solution.

Practice Strategy

Phase 1 — C Fundamentals

Syntax → Data Types → Operators → Input/Output → if/else → switch → loops.

Phase 2 — Logic Building

Number programs → digit programs → prime/palindrome/Armstrong → patterns.

Phase 3 — Core Coding

Functions → arrays → strings → searching → sorting.

Phase 4 — Advanced C Basics

Pointers → recursion → structures → dynamic memory → file handling.

Phase 5 — Interview Coding

Stack → queue → linked list → common array/string problems → timed practice.

Recommended Learning Roadmap

StageTopicsPriority
1C Syntax, Operators, Input/Output⭐⭐⭐
2if/else, switch, loops⭐⭐⭐
3Patterns and number problems⭐⭐⭐
4Functions and arrays⭐⭐⭐
5Strings and searching/sorting⭐⭐⭐
6Pointers and recursion⭐⭐⭐
7Structures and file handling⭐⭐
8Stack, queue and linked list⭐⭐⭐