C Programming Examples

This page contains the list of C programming examples which covers the concepts like basic c programs, programs on numbers, loop programs, functions, recursions etc.

All the C programming examples that are present in this page might contain at least three examples, which includes program using For Loop, using While Loop, methods. In some case, Recursions.

Simple C Programming Examples

The following C programming examples are the basic and simple programs. And the best way to learn them is by practicing all of the examples. We suggest you to understand the logic in the iteration wise. So that, you can write your own logic for future examples.

Please visit our C Language section to learn C Programming languages with examples.

  1. C Program to Print Hello World
  2. C Program to Add Two Numbers
  3. C Program for Average of Two Numbers
  4. C Program to Find the Absolute Value of a Number
  5. C program to find Compound Interest
  6. C program to Calculate Cube of a Number
  7. C Program to check Number is Even or Odd
  8. C Program to Print Even Numbers from 1 to N
  9. C Program to find Largest of Two Numbers
  10. C Program to find Largest of Three Numbers
  11. C Program to print Multiplication Table
  12. C program to find Number is Divisible by 5 and 11
  13. C Program for nCr Calculation
  14. C Program for nPr Calculation
  15. C Program to print Odd Numbers from 1 to N
  16. C program to calculate Power of a Number
  17. C program to find Profit or Loss
  18. C Program to Print an Integer, Character, and Float Value
  19. C Program to find the size of int, float, double, and char
  20. C Program to check Positive or Negative Number
  21. C Program to Print 1 to 100 without using Loop
  22. Roots of a Quadratic Equation
  23. Simple Interest
  24. Standard Deviation
  25. Sum of Even and Odd numbers in a Given Range
  26. Sum and Average of Three Numbers
  27. Square of a Number
  28. Square root of a Number
  29. C Program to Print First 10 Even Natural Numbers
  30. C Program to Print First 10 Natural Numbers
  31. C Program to Print First 10 Natural Numbers in Reverse
  32. C Program to Print First 10 Odd Natural Numbers
  33. C Program to Read 10 Numbers and Find their Sum and Average
  34. C Program to Find Sum of 10 Numbers and Skip Negative Numbers
  35. C Program to Find Sum of 10 Numbers until user enters positive number
  36. Sum of Even Numbers from 1 to n
  37. Sum of Odd Numbers from 1 to n
  38. Student Grade
  39. Total, Average, and Percentage of Five Subjects
  40. Multiply Two Floating Point Numbers
  41. Quotient and Remainder
  42. accept User Input and Print
  43. Arithmetic Operations using Functions
  44. Range of Data Types
  45. C program to Find the Distance Between Two Points

C Advanced Number Programs

The list of advanced Number programs in C Programming language with multiple examples.

  1. C Programs to check the Number is Armstrong Number
  2. C Program to Count Number of Digits in a Number
  3. C program to Check Number is a Prime, Armstrong, or Perfect Number
  4. C program to Calculate Electricity Bill
  5. C Program to find Factors of a Number
  6. C Program to find Factorial of a Given Number
  7. C program to print First Digit of Number
  8. C program to print First and Last Digit of a Number
  9. C program to calculate GCD of Two Numbers
  10. C program to calculate Generic Root of a Number
  11. C program to find Gross Salary of an Employee
  12. C program to print Last Digit of Number
  13. C program to calculate LCM of Two Numbers
  14. C program to find NCR Factorial of a Number
  15. C program to print Natural Numbers from 1 to N
  16. C program to print Natural Numbers in Reverse Order
  17. C program to check Krishnamurthy Number
  18. C program to check Neon Number
  19. C program to check Palindrome or Not
  20. C program to check Perfect Number or Not
  21. C program to check Prime Number
  22. C program to print Prime Numbers from 1 to 100
  23. C program to calculate Product of Digits of a Number
  24. C program to find Prime Factors of a Number
  25. C program to Reverse a Number
  26. C program to Reverse a Number using Recursive Function
  27. C example to Swap Two Numbers
  28. C example to find Sum of First and Last Digit of a Number
  29. C example to Swap First and Last Digit of a Number
  30. C example to find Sum of N Natural Numbers
  31. C example to calculate Sum and Average of N Numbers
  32. C program to check Strong Number
  33. Sum of Digits in a Given Number
  34. Simple Calculator
  35. Total Notes in a Given Amount

C Programs on Calendar

  1. C Programs to find the Leap Year
  2. C example to find the Day Name of a Week
  3. Days to Years Weeks and Days
  4. Number of Days in a Month

C Programs on Conversions

The following are the list of C programs to Convert

  1. Convert Binary to Decimal
  2. Convert Binary to Octal
  3. C example to Convert Centimeter to Meter and Kilometer
  4. Celsius to Fahrenheit
  5. Decimal to Binary Number
  6. Decimal to Octal Number
  7. Fahrenheit to Celsius
  8. Kilometer to Meter Centimeter and Millimeter
  9. Octal to Binary
  10. Octal to Decimal

C Programs on Characters

Below programs are the C Programs to Check whether the Character is

  1. ASCII Value of Single Character
  2. ASCII Values of all Characters
  3. Alphabet or Not
  4. Alphabet or Digit
  5. Convert Character to Uppercase
  6. Convert Character to Lowercase
  7. Digit or Not
  8. Digit or Alphabet or Special Character
  9. Lowercase or Not
  10. Lowercase or Uppercase Alphabet
  11. Print Alphabets from a to z
  12. Print Alphabets between A and Z
  13. Uppercase or Not
  14. Vowel or Consonant

C String Programs

The list of c programs on strings or character arrays.

  1. C programming language to find the ASCII Value of Total Characters in a String
  2. C example to find All Occurrence of a Character in a String
  3. C programming language to find Characters in a String
  4. C Program to Read Input and Print String
  5. Compare two Strings
  6. Concatenate Two Strings
  7. Copy String
  8. Count Alphabets, Digits and Special Characters in a String
  9. Count Vowels, and Consonants in a String
  10. Counting All Occurrence of a Character in a String
  11. Count Total Number of Words in a String
  12. Frequency of each Character in a String
  13. First Occurrence of a Character in a String
  14. First Occurrence of a Word in a String
  15. Last Occurrence of a Character in a String
  16. Length of a String
  17. Lowercase to Uppercase
  18. Maximum Occurring Character in a string
  19. Minimum Occurring Character in a String
  20. Palindrome String
  21. Remove First Occurrence of a Character in a String
  22. Remove Last Occurrence of a Character in a String
  23. Removing All Occurrences of a Character in a String
  24. Remove All Duplicate Characters in a String
  25. Remove All Characters in a String Except Alphabets
  26. Replace First Occurrence of a Character in a String
  27. Replace Last Occurrence of a Character in a String
  28. Replacing All Occurrence of a Character in a String
  29. Reverse a String
  30. Reverse a String using Recursion
  31. Reverse Order of Words in a String
  32. Toggle Case of all Characters in a String
  33. Uppercase to Lowercase
  34. C Program to Remove White Spaces from a String
  35. C program to Sort Names in Alphabetical Order

C Programming Examples on Area

The following are the list of C programs on Area.

  1. Area of a Circle
  2. Diameter, Circumference, and Area of a Circle
  3. Area of a Triangle
  4. Area of a Triangle using Base and Height
  5. Angle of a Triangle if two angles are given
  6. Triangle is Equilateral Isosceles or Scalene
  7. Use Angles to check Triangle is valid or Not
  8. Use Sides to check Triangle is Valid or Not
  9. Area of an Isosceles Triangle
  10. Area of Rectangle
  11. Area of a Rectangle using Length and Width
  12. Perimeter of a Rectangle using Length and Width
  13. Area of a Parallelogram
  14. Area of a Trapezoid
  15. Area of a Right Angled Triangle
  16. Find Area of an Equilateral Triangle
  17. Area of a Rhombus
  18. Perimeter of a Rhombus
  19. C Program to Find the Area of a Semicircle
  20. C Program to Find the Perimeter of a Square

C programs on Volume and Surface Area

Following are the list of Volume and Surface Area C programs

  1. Volume and Surface Area of Sphere
  2. Volume and Surface Area of a Cylinder
  3. Find Volume and Surface Area of a Cube
  4. Volume and Surface Area of a Cuboid
  5. Volume and Surface Area of a Cone

C Programs on Arrays

The following are the c Array programs

  1. C Program to Perform Arithmetic Operations on One Dimensional Array
  2. C Program to find the Number of Elements in an Array
  3. C example to Count Even and Odd Numbers in an Array
  4. C example Count Positive and Negative Numbers in an Array
  5. C example to Copy an Array to another
  6. Average of an Array
  7. Count Occurrence of an Element in an Array
  8. Count Frequency of each Element in an Array
  9. Count Total Number of Duplicate Elements in an Array
  10. Delete an Element in an Array
  11. Delete Duplicate Elements from an Array
  12. Insert an Element into an Array
  13. Largest Number in an Array
  14. Largest and Smallest Number in an Array
  15. Length or Size of an Array
  16. Merge Two Arrays
  17. Print Elements in an Array
  18. Put Even and Odd Numbers in two Separate Arrays
  19. Put Positive and Negative Numbers in two Separate Arrays
  20. Print Negative Numbers in an Array
  21. Print Positive Numbers in an Array
  22. Reverse an Array
  23. Search for Element in an Array
  24. Second largest Number in an Array
  25. Smallest Number in an Array
  26. Second Smallest Element in an Array
  27. Sort Array in Ascending Order
  28. Sort Array in Descending Order
  29. Sum of all Elements in an Array
  30. Sum of Even and Odd Numbers in an Array
  31. Swap Two Arrays Without Using Temp Variable
  32. Unique Elements in an Array
  33. C Program to Increment All Elements of an Array by One
  34. C Program to Print the Kth Element in an Array
  35. C Program to Left Rotate Array Items
  36. C Program to Right Rotate Array Elements
  37. C Program to Find Array Elements Greater than Average
  38. C Program to Print 2D Array Elements

C Programs on Matrix

  1. Arithmetic Operations on Multi-Dimensional Arrays
  2. add two Matrices
  3. Check Two Matrices are Equal or Not
  4. Determinant of a Matrix
  5. Identity Matrix
  6. Interchange Diagonals of a Matrix
  7. Lower Triangle Matrix
  8. Scalar Multiplication of a Matrix
  9. Sparse Matrix
  10. Sum of Diagonal Elements in a Matrix
  11. Sum of each and every Row and Column in a Matrix
  12. Summing each row in a Matrix
  13. Sum of each column in a Matrix
  14. Subtract Two Matrices
  15. Sum of Lower Triangle Matrix
  16. Sum of Opposite Diagonal Elements in a Matrix
  17. Symmetric Matrix
  18. Sum of Upper Triangle Matrix
  19. Transpose a Matrix
  20. Upper Triangle Matrix
  21. C Program to Find the Normal of a Matrix
  22. C Program to Find the Trace of a Matrix

C Programs on Sort Examples

  1. Bubble Sort
  2. Quick Sort
  3. Insertion Sort
  4. Selection Sort

C Programs on Pointers

  1. Add Two Numbers using Pointers
  2. Create, Initialize, and Access a Pointer Variable
  3. Count Vowels and Consonants in a String using a Pointer
  4. Largest of Two Numbers using a Pointer
  5. Largest of Three Numbers using a Pointer
  6. Pass Pointers as the Function Arguments
  7. Print String using Pointer
  8. Read and Print Array Elements using a Pointer
  9. Sort an Array using a Pointer
  10. Sum and Average of Array Elements using a Pointer
  11. Swap Two Numbers using Pointer

C Programs to print Series

  1. Fibonacci Series Program
  2. Find Nth Fibonacci Number
  3. Sum of Fibonacci Series
  4. Sum of series 1²+2²+3²+….+n²
  5. Sum of series 1³+2³+3³+….+n³
  6. Find Sum of Geometric Progression Series
  7. Sum of Arithmetic Progression Series

C Programs to display Patterns and Shapes

The following are the list of C programs to Print patterns and shapes.

  1. C Program to Print Christmas Tree Star Pattern
  2. C Program to Print Alphabet A Star Pattern
  3. C Example to print exponentially Increasing Star Pattern
  4. C example to Print Floyd’s Triangle
  5. C example to Print Diamond Star Pattern
  6. C example to Print Half Diamond Star Pattern
  7. C example to Print Mirrored Half Diamond Star Pattern
  8. C example to Print Left Arrow Star Pattern
  9. C example to Print Pascal Triangle
  10. C example to Print Pyramid Star Pattern
  11. C example to Print Hollow Pyramid Star
  12. C example to Print Inverted Pyramid Star Pattern
  13. C example to Print Hollow Inverted Star Pyramid
  14. Plus Star Pattern
  15. Rectangle Star Pattern
  16. Hollow Rectangle Star Pattern
  17. Right Arrow Star Pattern
  18. Right Angled Triangle Star Pattern
  19. Hollow Right Triangle Star Pattern
  20. Reversed Mirrored Right Triangle
  21. Mirrored Right Triangle Star Pattern
  22. Hollow Mirrored Right Triangle Star Pattern
  23. Inverted Right Triangle Star Pattern
  24. Hollow Inverted Right Triangle Star Pattern
  25. Inverted Mirrored Right Triangle Star Pattern
  26. Hollow Inverted Mirrored Right Triangle Star Pattern
  27. Rhombus Star Pattern
  28. Hollow Rhombus Star Pattern
  29. Mirrored Rhombus Star Pattern
  30. Hollow Mirrored Rhombus Star Pattern
  31. Square Star Pattern
  32. Hollow Square Star Pattern
  33. Hollow Square Pattern With Diagonals
  34. C Program to Print Hollow Sandglass Star Pattern
  35. C Program to Print H Star Pattern
  36. C Program to Print V Star Pattern
  37. C Program to Print Inverted V Star Pattern
  38. C Program to Print W Star Pattern
  39. C programs to Print X Star Pattern
  40. Print 8 Star Pattern

C Programs on Alphabet Pattern

  1. C Program to Print Diamond Alphabets Pattern
  2. C Program to Print Downward Triangle Alphabets Pattern
  3. C Program to Print Downward Triangle Mirrored Alphabets Pattern
  4. C Program to Print Inverted Right Triangle Alphabets Pattern
  5. C Program to Print Inverted Triangle Alphabets Pattern
  6. C Program to Print K Shape Alphabets Pattern
  7. C Program to Print Left Arrow Alphabets Pattern
  8. C Program to Print Mirrored Right Triangle Alphabets Pattern
  9. C Program to Print Pyramid Alphabets Pattern
  10. C Program to Print Right Arrow Alphabets Pattern
  11. C Program to Print Right Pascals Triangle Alphabets Pattern
  12. C Program to Print Right Triangle Alphabets Pattern
  13. C Program to Print Right Triangle of Alphabets in Reverse
  14. C Program to Print Right Triangle Characters Pattern
  15. C Program to Print Right Triangle of Consecutive Alphabets Pattern
  16. C Program to Print Right Triangle of Consecutive Row Alphabets Pattern
  17. C Program to Print Right Triangle of Same Alphabet in each Column
  18. C Program to Print Right Triangle of Mirrored Alphabets Pattern
  19. C Program to Print Right Triangle of Incremental Alphabets Pattern
  20. C Program to Print Sandglass Alphabets Pattern
  21. C Program to Print Square of Right Increment Alphabets Pattern
  22. C Program to Print Triangle Alphabets Pattern
  23. C Program to Print Triangle of Alphabets in Reverse Pattern
  24. C Program to Print Triangle of Mirrored Alphabets Pattern
  25. C Program to Print Triangle of Same Alphabets Pattern

C Number pattern programs

The following are the remaining number pattern C programs.

  1. C Star Pattern Programs
  2. C Number Pattern Programs
  3. C Alphabet Pattern Programs
  4. C Programs to Print Box Number Pattern of 1 and 0
  5. C Program to Print Downward Triangle Mirrored Numbers Pattern
  6. C example to Print Hollow Box Number
  7. C example to Print Inverted Right Triangle Number Pattern
  8. C Program to Print Inverted Triangle Numbers Pattern
  9. C Program to Print K Shape Number Pattern
  10. C example to Print 1 and 0 in Alternative Rows
  11. C example to Print 1 and 0 in Alternative Columns
  12. C Program to Print Left Arrow Numbers Pattern
  13. C Program to Print Pyramid Numbers Pattern
  14. C Program to Print Right Pascals Triangle of Multiplication Numbers Pattern
  15. C Program to Print Right Pascals Triangle of Mirrored Numbers Pattern
  16. C example to Print Right Triangle Number Pattern
  17. C Program to Print Consecutive Column Numbers in Right Triangle
  18. C Program to Print Consecutive Row Numbers in Right Triangle
  19. C Program to Print Numeric Right Triangle Pattern 2
  20. C Program to Print Numeric Right Triangle Pattern 3
  21. C Program to Print Right Triangle of Fibonacci Series Numbers Pattern
  22. C Program to Print Right Triangle of Incremented Numbers
  23. C program to print Right Triangle of Numbers in Decreasing order
  24. C Program to Print Right Triangle of Mirrored Numbers Pattern
  25. C Program to Print Right Triangle of Numbers in Sine Wave Pattern
  26. C Program to print Square Number Pattern
  27. C Program to Print Square where each row contains one Number
  28. C Program to Print Square where each column contains one Number
  29. C Program to Print Square of Left Shift Numbers Pattern
  30. C Program to Print Square of Left Decrement Numbers Pattern
  31. C Program to Print Square of Right Increment Numbers Pattern
  32. C Program to Print Square With Diagonal Numbers Pattern
  33. C Program to Print Same Numbers in Rows and Columns
  34. C Program to Left Shift the Square Pattern of Odd Numbers
  35. C Program to Print Square of Right Decrement Numbers Pattern
  36. C Program to Print Square of Numbers in Sine Wave Pattern
  37. C program to Print Sandglass Number Pattern
  38. C Program to Print Triangle Numbers Pattern
  39. C Program to Print Triangle of Numbers in Reverse Pattern
  40. C Programs to Print Triangle of Mirrored Numbers Pattern
  41. C Program to Print V Numbers Pattern

Comments are closed.