C Programming Examples

This page contains C programming examples with solution code and output tested on Linux system. It covers examples on C programming concepts like do while loop, while loop, for loop, arrays, strings, functions, recursion, pointers, command line arguments, preprocessor directives, file handling, structures, sorting algorithms.

Note: C programs based on bitwise operators, nested structures and unions, handling text (.txt) files and binary file handling will be added soon. Also complex real world problem solutions using C programming language will be added soon and pdf support will be provided as soon as possible so you can download the programs and use them even if you are offline. Stay tuned for the updates.


Simple C programs:

  1. C Program For Area of Circle
  2. Find Area To Be Painted In C
  3. Perform All Arithmetic Operations In C
  4. C Program To Calculate Gross Salary
  5. C program to find profit and loss
  6. C Program To Accept Annual Salary And Print Tax
  7. Calculate Perimeter And Area of Ring In C
  8. C Program To Find Distance And Velocity
  9. Find quadrant in which point lies in c
  10. C Program To Find Roots of Quadratic Equation In C
  11. Check First Number is Between Second And Third In C
  12. C Program To Find Number of Currency Notes
  13. C Program To Calculate Surface Area And Volume of Cuboid
  14. C Program To Calculate Circumference of Circle
  15. Check An Alphabet is Uppercase Or Lowercase In C
  16. C Program To Find Surface Area And Volume of Cylinder
  17. C Program To Check Whether The Number is Divisible By 5 And 7
  18. Check triangle is valid or not in c
  19. Check time is correct or not in c
  20. C Program to Convert Temperature in Farenheit to Celsius and Kelvin
  21. C Program for Arithmetic, Harmonic and Geometric Mean
  22. C Program To Swap Two Numbers
  23. C Program To Find Distance Between Two Points
  24. Check whether character is digit or not in c
  25. C Program To Display Next And Previous Character of Given Character
  26. C Program To Find Minimum And Maximum of Three Numbers
  27. C Program To Check Number is Even or Odd
  28. C Program To Check Character is Vowel or Consonant
  29. C Program To Display ASCII Value of a Character
  30. C Program To Check Given Year is Leap or Not
  31. C Program To Display A Digit in Word
  1. Menu Driven C Program To Perform Operations on Two Points
  2. C Program To Perform Arithmetic Operations On Two Numbers
  3. C Program To Perform Different Operations On Two Numbers
  4. C program to display number in words
  5. C Program To Accept Radius From User And Perform Different Operation It

C Programs Using Do While Loop:

  1. C Program To Check Perfect Number
  2. C Program To Reverse Given Number
  3. C Program To Compute Power

C Programs Using While Loop:

  1. C Program to Print Sum of Digits of A Number
  2. C Program to Count Digits of a Number
  3. C Program to Count Words Characters and Lines till user enters EOF
  4. C program to find longest line
  5. C program to convert binary number into decimal
  6. C program to convert binary number to octal
  7. C program to convert binary number to hexadecimal
  8. C program to convert decimal number into octal
  9. C program to convert decimal number to hexadecimal
  10. C Program to Convert Octal to Decimal
  11. C program to convert hexadecimal to binary

C Programs Using For Loop:

  1. C Program To Display Prime Numbers Between A Range
  2. C Program To Display Tables For a Range
  3. C Program To Display First n Fibonacci Numbers (0,1,1,2,3,....
  4. C Program to Find Factorial of A Number
  5. C Program for Armstrong Numbers Between 1 to 500
  6. C Program To Display Multiplication Table
  7. C Program to check Prime Number
  8. C program to display even numbers
  9. C program to display series x+3x+5x+7x+....
  10. Convert Text String to Binary in C

C Programs For Patterns:

  1. C Program For Numbers Triangle (Pattern)
  2. C Program To Display Decreasing Star Triangle (Pattern)
  3. C Program To Print Triangle of Alphabets (Pattern)
  4. C Program to Print Inverted Half Triangle of Alphabets (Pattern)
  5. C program to print or display diamond pattern
  6. C program to print heart star pattern

C Programs on Arrays:

  1. C Program To Add Integers of Two Arrays
  2. C Program To Add Two Matrices
  3. C Program to Check Identity Matrix
  4. C Program To Check Whether The Number is Present in The Array or Not
  5. C Program To Find Minimum Number From Array
  6. C Program To Print Array In Reverse Order
  7. C Program to Find Sum of Array Elements
  8. C Program to Calculate Sum of Array Elements
  9. C Program To Find Transpose of A Matrix
  10. C program to count frequency of each element in an array
  11. C program to find average of array
  12. C Program to Delete Integer From Array

C Programs on Strings:

  1. C Program To Check Whether The String is Palindrome or Not
  2. C Program to check whether the character is present in the string or not
  3. C Program To Alter Sentence By Replacing Space By *
  4. C Program To Accept n Strings And Display The Largest
  5. C Program To Perform Different Operations On Strings
  6. C Program To Sort Words In Dictionary Order
  7. Write user defined functions for strcat, strcmp, strupr, strrev
  8. C Program To Display String In Reverse Order Using Recursion

C Programs on Functions:

  1. C Program to Check Whether Given Number is Armstrong Number or Not Using Function
  2. C Program To Check Leap Year
  3. C Program For User Defined Power Function
  4. C Program To Find Minimum Number In Array Using Function Up To Certain Position
  5. C Program To Find Maximum Number in an Array using Function
  6. C program to convert roman number into decimal
  7. C program to convert decimal number into it roman equivalent

C Programs on Recursion:

  1. C Program To Find Factorial Using Recursion
  2. C Program To Find nth Fibonacci Number Using Recursion
  3. C Program to Find Sum of Digits of a Number Using Recursion
  4. C Program to Reverse a Number using While Loop
  5. C Program to Reverse a Number using Recursion
  6. C Program To Find Product of Two Numbers Using Recursion
  7. C Program to Check Number is Prime or Not Using Recursion

C Programs on Pointers

  1. C Program To Print Address of Memory Location Using Pointer
  2. C Program To Swap Two Integers Using A Pointer

C Programs on Command Line Arguments And Preprocessor Directives:

  1. C Program To Accept Three Integers As Command Line Arguments And Find Minimum,Maximum And Average
  2. C Program To Compare Two Strings Using Macro
  3. Check Integers Are Equal Or Not Using Macro
  4. C Program For Finding The Largest of Two Numbers Using Macros

C Programs on Structures:

  1. C Program To Create A Structure Employee
  2. C Program To Create Structure Student And To Perform Various Operations On It
  3. C Program To Create A Structure Library I
  4. C Program To Create A Structure Library II

C Programs on File Handling:

  1. C Program To Copy Contents To Another File
  2. C Program To Count Number of Words,Lines Characters In A File

C Programs on Sorting Algorithms:

C Programs on Bubble Sort:

  1. C Program For Bubble Sort On Random Array (Ascending Order)
  2. C Program For Bubble Sort On Random Array (Descending Order)
  3. C Program To Sort Array Elements In Descending Order Using Bubble Sort
  4. C Program to Sort File Using Bubble Sort
  5. C Program to Sort File On Names In Alphabetical Order Using Bubble Sort

C Programs on Insertion Sort:

  1. C program for insertion sort
  2. C Program For Insertion Sort On Random Array (Ascending Order)
  3. C Program For Insertion Sort On Random Array (Descending Order)

C Programs on Quick Sort:

  1. C Program for Quick Sort

C Programs on Merge Sort:

  1. C Program for Merge Sort

C programs on searching techniques

  1. C program for linear search
  2. C program for binary search