🔴 Advanced · Lesson 47
50 Important C Programs
50 Important Programs
Why Practice Programs?
C becomes strong only through regular program practice. The following 50 programs cover basics, loops, arrays, strings, pointers, structures, files and data structures.
50 Important C Programs
- 1. Hello World
- 2. Sum of two numbers
- 3. Even or odd
- 4. Largest of two numbers
- 5. Largest of three numbers
- 6. Leap year
- 7. Factorial
- 8. Fibonacci series
- 9. Prime number
- 10. Palindrome number
- 11. Armstrong number
- 12. Reverse number
- 13. Sum of digits
- 14. Multiplication table
- 15. Swap two numbers
- 16. Simple calculator
- 17. Area of circle
- 18. Celsius to Fahrenheit
- 19. Array sum
- 20. Array maximum
- 21. Array minimum
- 22. Linear search
- 23. Binary search
- 24. Bubble sort
- 25. Selection sort
- 26. Insertion sort
- 27. Matrix addition
- 28. Matrix multiplication
- 29. String length
- 30. String reverse
- 31. String palindrome
- 32. Count vowels
- 33. Copy string
- 34. Compare strings
- 35. Function for factorial
- 36. Recursion factorial
- 37. Recursion Fibonacci
- 38. Pointer swap
- 39. Pointer array sum
- 40. Structure student record
- 41. Union example
- 42. Enum week days
- 43. File write
- 44. File read
- 45. Append file
- 46. Linked list insert
- 47. Stack using array
- 48. Queue using array
- 49. Dynamic memory array
- 50. Command line sum
Sample Program: Prime Number
C Language
#include <stdio.h>
int main() {
int n, flag = 1;
printf("Enter number: ");
scanf("%d", &n);
if(n <= 1) flag = 0;
for(int i = 2; i * i <= n; i++) {
if(n % i == 0) {
flag = 0;
break;
}
}
if(flag) printf("Prime");
else printf("Not Prime");
return 0;
}Sample Program: Reverse Number
C Language
int n = 1234, rev = 0;
while(n > 0) {
rev = rev * 10 + n % 10;
n = n / 10;
}
printf("Reverse = %d", rev);Practice Tips
- First write logic in plain language
- Then write algorithm or flow steps
- Code without copying after understanding
- Run with different test cases
- Keep a notebook of common mistakes
Programs Practice क्यों?
C strong करने के लिए regular program practice बहुत जरूरी है। ये 50 programs basics से advanced तक cover करते हैं।
50 Programs List
- 1. Hello World
- 2. Sum of two numbers
- 3. Even or odd
- 4. Largest of two numbers
- 5. Largest of three numbers
- 6. Leap year
- 7. Factorial
- 8. Fibonacci series
- 9. Prime number
- 10. Palindrome number
- 11. Armstrong number
- 12. Reverse number
- 13. Sum of digits
- 14. Multiplication table
- 15. Swap two numbers
- 16. Simple calculator
- 17. Area of circle
- 18. Celsius to Fahrenheit
- 19. Array sum
- 20. Array maximum
- 21. Array minimum
- 22. Linear search
- 23. Binary search
- 24. Bubble sort
- 25. Selection sort
- 26. Insertion sort
- 27. Matrix addition
- 28. Matrix multiplication
- 29. String length
- 30. String reverse
- 31. String palindrome
- 32. Count vowels
- 33. Copy string
- 34. Compare strings
- 35. Function for factorial
- 36. Recursion factorial
- 37. Recursion Fibonacci
- 38. Pointer swap
- 39. Pointer array sum
- 40. Structure student record
- 41. Union example
- 42. Enum week days
- 43. File write
- 44. File read
- 45. Append file
- 46. Linked list insert
- 47. Stack using array
- 48. Queue using array
- 49. Dynamic memory array
- 50. Command line sum
Sample Program: Prime Number
C Language
int n, flag = 1;
scanf("%d", &n);
if(n <= 1) flag = 0;
for(int i = 2; i * i <= n; i++) {
if(n % i == 0) {
flag = 0;
break;
}
}Practice Tips
- पहले logic plain language में लिखें
- फिर algorithm बनाएं
- समझकर code करें
- Different test cases run करें
- Common mistakes note करें