C Programs

Last Updated : 27 Dec, 2025

To learn anything effectively, practicing and solving problems is essential. To help you master C programming, we have compiled over 100 C programming examples across various categories, including basic C programs, Fibonacci series, strings, arrays, base conversions, pattern printing, pointers, and more. These C Examples cover a range of questions, from fundamental concepts to advanced topics, and are frequently asked in C-based programming interviews.

Before you start with these C programs, take a look at our C tutorial to get a good understanding of the basics.

Basic

  1. C Hello World Program
  2. C Program to Print Your Own NameĀ 
  3. C Program to Print an Integer Entered By the User
  4. C Program to Add Two Numbers
  5. C Program to Check Whether a Number is Prime or Not
  6. C Program to Multiply two Floating-Point NumbersĀ 
  7. C Program to Print the ASCII Value of a Character
  8. C Program to Swap Two Numbers
  9. C Program to Calculate Fahrenheit to Celsius
  10. C Program to Find the Size of int, float, double, and char
  11. C Program to Add Two Complex NumbersĀ 
  12. CĀ Program to Print Prime Numbers From 1 to NĀ 
  13. C Program to Find Simple Interest
  14. C Program to Find Compound Interest
  15. C Program for Area And Perimeter Of RectangleĀ 

Control Flow

  1. C Program to Check Whether a Number is Positive, Negative, or Zero
  2. C Program to Check Whether Number is Even or Odd
  3. C Program to Check Whether a Character is Vowel or ConsonantĀ 
  4. C Program to Find Largest Number Among Three Numbers
  5. C Program to Calculate Sum of Natural NumbersĀ 
  6. C Program to Print Alphabets From A to Z Using Loop
  7. C Program to Check Leap Year
  8. C Program to Find Factorial of a Number
  9. C Program to Make a Simple CalculatorĀ 
  10. C Program to Generate Multiplication TableĀ 
  11. C Program to Print Fibonacci Series
  12. CĀ Program to Find LCM of Two Numbers
  13. C Program to Check Armstrong Number
  14. C Program to Display Armstrong Numbers Between 1 to 1000Ā 
  15. C Program to Display Armstrong Number Between Two IntervalsĀ 
  16. C Program to Reverse a Number
  17. C Program to Check Whether a Number is a Palindrome or NotĀ 
  18. C Program to Check Whether a Number is Prime or Not
  19. C Program to Display Prime Numbers Between Intervals
  20. CĀ Program to Check whether the input number is a Neon Number
  21. C Program to Find All Factors of a Natural Number
  22. CĀ program to Ā Sum of Fibonacci Numbers at Even Indexes up to N TermsĀ 

Pattern Printing

  1. C Program to Print Simple Pyramid PatternĀ 
  2. C Program to Print Given TriangleĀ 
  3. C Program to Print 1800 Rotation of Simple Pyramid
  4. C Program to Print Inverted PyramidĀ 
  5. C Program to Print Number Pattern
  6. C Program to Print Character Pattern Ā 
  7. C Program to Print Continuous Character Pattern
  8. C Program to Print Hollow Star Pyramid
  9. C Program to Print Inverted Hollow Star pyramidĀ 
  10. C Program to Print Hollow Star Pyramid in a Diamond Shape
  11. C Program to Print Full Diamond Shape Pyramid
  12. C Program to Print Pascal's Pattern Triangle PyramidĀ 
  13. C Program to Print Floyd's Pattern Triangle PyramidĀ 
  14. C Program to Print Reverse Floyd pattern Triangle PyramidĀ 

Functions

  1. C Program to Check Prime Number By Creating a FunctionĀ 
  2. C Program to Display Prime Numbers Between Two Intervals Using FunctionsĀ 
  3. C Program to Find All Roots of a Quadratic Equation
  4. C Program to Check Whether a Number can be Express as Sum of Two Prime Numbers
  5. C Program to Find the Sum of Natural Numbers using RecursionĀ 
  6. C Program to Calculate the Factorial of a Number Using RecursionĀ 
  7. C Program to Find G.C.D Using Recursion
  8. C Program to Reverse a Stack using Recursion
  9. C Program to Calculate Power Using Recursion

Arrays

  1. C Program to Print a 2D Array
  2. C Program to Find the Largest Element in an Array
  3. C Program to Find the Maximum and Minimum in an Array
  4. C Program to Search an Element in an Array (Binary search)
  5. C Program to Calculate the Average of All the Elements Present in an ArrayĀ 
  6. C Program to Sort an Array using Bubble Sort
  7. C Program to Sort an Array using Merge Sort
  8. C Program to Sort an Array Using Selection SortĀ 
  9. C Program to Sort an Array Using Insertion Sort
  10. C Program to Sort the Elements of an Array in Descending Order
  11. C Program to Sort the Elements of an Array in Ascending OrderĀ 
  12. C Program to Remove Duplicate Elements From a Sorted Array
  13. C Program to Merge Two ArraysĀ 
  14. C Program to Remove All Occurrences of an Element in an ArrayĀ 
  15. C Program to Find Common Array ElementsĀ Ā 
  16. C Program to Copy All the Elements of One Array to Another Array
  17. C Program For Array RotationĀ 
  18. C Program to Sort the 2D Array Across Rows
  19. C Program to Check Whether Two Matrices Are Equal or NotĀ 
  20. C Program to Find the Transpose
  21. C Program to Find the Determinant of a Matrix
  22. C Program to Find the Normal and TraceĀ 
  23. C Program to Add Two Matrices
  24. C Program to Multiply Two Matrices
  25. C Program to Print Boundary Elements of a MatrixĀ 
  26. C Program to Rotate Matrix ElementsĀ 
  27. C Program to Compute the Sum of Diagonals of a MatrixĀ 
  28. C Program to Interchange Elements of First and Last in a Matrix Across RowsĀ 
  29. C Program to Interchange Elements of First and Last in a Matrix Across ColumnsĀ 

Strings

  1. C Program to Add or Concatenate Two Strings
  2. C Program to Add 2 Binary Strings
  3. C Program to Get a Non-Repeating Character From the Given String
  4. C Program to check if the string is palindrome or not
  5. C Program to Reverse an Array or String
  6. C program to Reverse a String Using Recursion
  7. C Program to Find the Length of a String
  8. C Program to Sort a String
  9. C Program to Check For Pangram String
  10. C Program to Print the First Letter of Each WordĀ 
  11. C Program to Determine the Unicode Code Point at a Given IndexĀ 
  12. C Program to Remove Leading ZerosĀ 
  13. C Program to Compare Two Strings
  14. C Program to Compare Two Strings LexicographicallyĀ 
  15. C Program to Insert a String into Another String
  16. C Program to Split a String into a Number of Sub-StringsĀ 

Conversions

  1. C Program For Boolean to String ConversionĀ 
  2. C Program For Float to String Conversion
  3. C Program For Double to String ConversionĀ 
  4. C Program For String to Long Conversion
  5. C Program For Long to String Conversion
  6. C Program For Int to Char ConversionĀ 
  7. C Program For Char to Int ConversionĀ 
  8. C Program For Octal to Decimal ConversionĀ 
  9. C Program For Decimal to Octal Conversion
  10. C Program For Hexadecimal to Decimal ConversionĀ 
  11. C Program For Decimal to Hexadecimal ConversionĀ 
  12. C Program For Decimal to Binary ConversionĀ 
  13. C Program For Binary to Decimal Conversion

Pointers

  1. How to Return a Pointer from a Function in C
  2. How to Declare a Two-Dimensional Array of Pointers in C?
  3. C Program to Find the Largest Element in an Array using Pointers
  4. C Program to Swap Two Numbers
  5. C Program to Sort an Array using Pointers
  6. C Program to Sort a 2D Array of Strings
  7. C Program to Check if a String is a Palindrome using Pointers
  8. C Program to Create a Copy of a Singly Linked List using Recursion

Structures and Unions

  1. C Program to Store Information of Students Using Structure
  2. C Program to Store Student Records as Structures and Sort them by Name
  3. C Program to Add N Distances Given in inch-feet System using Structures
  4. C Program to Add Two Complex Numbers by Passing Structure to a Function
  5. C Program to Store Student Records as Structures and Sort them by Age or ID
  6. Read/Write Structure to a File in CĀ 
  7. Flexible Array Members in a Structure in C

File IO

  1. C Program to Create a Temporary File
  2. C Program to Read/Write Structure to a File
  3. C Program to Rename a file
  4. C Program to Make a File Read-Only
  5. C program to Compare Two Files and Report Mismatches
  6. C Program to Copy One File into Another FileĀ 
  7. C Program to Print all the Patterns that Match Given Pattern From a File
  8. C Program to Append the Content of One Text File to Another
  9. C Program to Read Content From One File and Write it Into Another File
  10. C Program to Read and Print all Files From a Zip FileĀ 

Date and Time

  1. C Program to Format time in AM-PM formatĀ 
  2. C program to Print Digital Clock with the Current Time
  3. C Program to Display Dates of Calendar Year in Different Formats
  4. C Program to Display Current Date and Time
  5. C Program to Maximize Time by Replacing ā€˜_’ in a Given 24-Hour Format Time
  6. C Program to Convert the Local Time to GMT
  7. C Program to Convert Hours into Minutes and Seconds

More C Programs

  1. C Program to Show Runtime exceptionsĀ 
  2. C Program to Show Types of errorsĀ 
  3. C Program to Show Unreachable Code ErrorĀ 
  4. C Program to Find Quotient and RemainderĀ 
  5. C Program to Find the Initials of a NameĀ 
  6. C Program to Draw a Circle in Graphics
  7. Printing Source Code of a C Program Itself
Comment