C Programming Examples/ C Programs

This section contains all C programs on various topics; these c programs are solved and explained with suitable examples containing outputs with possible input values. Here you will find c programs on Basic Input Output, If else Based programs, switch and case programs, looping programs, jumping statements (return, goto, break, continue), array (one dimensional, two dimensional) programs, structure and union programs, pointer programs, file handling programs, recursion programs, string manipulation programs, miscellaneous problem programs and many more topic that we will cover in this section.

As we know C programming language is the base of all programming, provided programs are unique having great logic. By solving these programs you can definitely improve your problem solving capabilities. All C programs are written and reviewed by highly educated and experienced guys who are working in Multi National Companies and Highly reputed College or University.

In this website we also provided Advance C programs, Tough/Tricky C programs also know as Puzzles programs and Frequently Asked C programs in Interview by many Multi National Companies. Along with C programs here you will find C Aptitude Questions and Answers, C Interview Questions and Answers and C commonly asked Problems/Errors/Bugs.

Everything related to C programming Language with C programs, you will find here. We tried to provide solution on every single topic with suitable program and examples.

For fun with C programs we also published Age Calculator program in C, EMI Calculator Program in C, Love Calculator program in C and Guess Random Generated Number program in C. Whenever you feel bored you can enjoy by programming. As we know standard compiler for C programming is gcc and g++, so we provided some of the programs on Linux based problems.



Here are the List of C programs (C programming Examples)

C Basic Input Output Solved Programs.

  1. Program to print "Hello World!" / First C program.
  2. Program to find sum and average of two numbers.
  3. Program to calculate simple interest.
  4. Program to check whether number is EVEN or ODD.
  5. Program to find largest number among three numbers.
  6. Program to find gross salary of an employee.
  7. Program to convert temperature from Fahrenheit to Celsius and vice versa.
  8. Program to calculate X^N (X to the power of N) using pow function.
  9. Program to find the difference of two numbers.
  10. Program to print size of variables using sizeof() operator.
  11. Program to demonstrate examples of escape sequences.
  12. Program to find area and perimeter of circle.
  13. Program to find area of a rectangle.
  14. Program to calculate HCF of two numbers.
  15. Program to multiply two numbers using plus operator.
  16. Program to demonstrate example of global and local scope.
  17. Program to demonstrate example of floor and ceil functions.
  18. C program to read Formatted Time Once through Scanf in C Language.
  19. C program to define, modify and access a global variable.
  20. C program to convert feet to inches.
  21. C program to print value in Decimal, Octal, Hexadecimal using printf.
  22. C program to print ASCII value of entered character.
  23. C program to print How Many Inputs are taken from Keyboard using Scanf?
  24. C Program to calculate Employee and Employer Provident Fund.
  25. C program to set buffer with specific value using memset in C - Example of memset().

Bitwise related Programs

  1. Program to get binary number of a decimal number.
  2. Program to get minimum number of bits to store an integer number.
  3. Program to swap bytes [for example convert 0x1234 to 0x3412].
  4. Program to swap two bits.
  5. Program to reverse bits of a number.
  6. Program to count number of 1's in a number.
  7. Program to swap nibbles of a byte/word.
  8. Program to demonstrate left shift (<<) operator.
  9. Program to demonstrate right shift (>>) operator.
  10. Program to set/clear (low/high) bits of a number.
  11. Program to swap two numbers using bitwise operator.

Looping Programs

  1. C Program to print tables from numbers 1 to 20.
  2. C Program to check entered number is ZERO, POSITIVE or NEGATIVE until user does not want to quit.
  3. C Program to find factorial of a number.
  4. C Program to find sum of first N natural number, N must be taken by the user.
  5. C program to print all prime numbers from 1 to N.
  6. C program to print all even and odd numbers from 1 to N.
  7. C program to print all Armstrong numbers from 1 to N.
  8. C program to print square, cube and square root of all numbers from 1 to N.
  9. C program to print all leap years from 1 to N.
  10. C program to print all upper case and lower case alphabets.

String User Defined Functions Programs

  1. Program to calculate length of the string.
  2. Program to copy one string to another.
  3. Program to convert string into lower and upper case without using library function.
  4. Program to compare two strings using case and ignoring case without using library functions.
  5. Program to concatenate two strings without using library function.
  6. Program to reverse a string.
  7. Program to split string by space into words.
  8. Program to toggle each character in a string.
  9. Program to count upper case and lower case characters in a string.
  10. Program to count digits, spaces, special characters, alphabets in a string.

Number (Digits Manipulation) Programs

  1. Program to reverse a number (for exampleinput: 1234, output: 4321).
  2. Program to calculate SUM & PRODUCT of all digits.
  3. Program to check number is prime or not.
  4. Program to check number is palindrome or not.
  5. Program to check number is Armstrong or not.
  6. Program to count digits in a numbers.
  7. Program to print occurrence of a particular digit in a number.
  8. Program to check number is perfect or not.
  9. Program to check number is power of 2 or not.
  10. Program to check number is perfect square or not.

Number System Conversion Programs

  1. C program to convert number from decimal to binary.
  2. C program to convert number from decimal to octal.
  3. C program to convert number from decimal to hexadecimal.
  4. C program to convert number from binary to decimal.
  5. C program to convert number from octal to decimal.
  6. C program to convert number from hexadecimal to decimal.

One Dimensional (1D) Arrays programs

  1. Program to read and print one dimensional array.
  2. Program to calculate Sum, Product of all elements.
  3. Program to find largest & smallest element among all elements.
  4. Program to replace EVEN elements by 0 and ODD elements by 1.
  5. Program to merge two arrays.
  6. Program to add and subtract elements of two array.
  7. Program to find a number from array elements.
  8. Program to sort array elements in ascending order.
  9. Program to reverse array element.
  10. Program to swap adjacent elements of a one dimensional array
  11. Program to find occurrence of an element in one dimensional array.
  12. Program to sort an one dimensional array in ascending order.
  13. Program to sort an one dimensional array in descending order.
  14. Program to delete given element from one dimensional array.
  15. Program to create array with reverse elements of one dimensional array.

Two Dimensional (2D) Arrays (Matrix) programs

  1. C Program to Read and Print a RxC Matrix, R and C must be input by the User.
  2. C Program to Read a Matrix and find Sum and Product of all elements.
  3. C Program to find Sum of all elements of each row of a matrix.
  4. C Program to Transpose a Matrix.
  5. C Program to Read a Matrix and Print Diagonals.
  6. C Program to find sum and subtraction of two matrices.
  7. C Program to find multiplication of two matrices

File Handling programs

  1. Program to create, open and close a file.
  2. Program to write text (characters) into file and print.
  3. program to print given number of lines of a file (like head command in Linux).
  4. program to print contents in reverse order of a file (just like TAC command in Linux).
  5. program to compare contents of two files.
  6. program to copy number of bytes of from a specific offset to another file.

Structure and Union programs

  1. Program to create, declare and initialize structure.
  2. Program to read and print an employee's detail using structure.
  3. Program to demonstrate example of nested structure.
  4. Program to demonstrate example structure pointer (structure with pointer).
  5. Program to demonstrate example structure pointer (structure with pointer) using user define function.
  6. Program to declare, initialize an union, example of union
  7. Program to demonstrate example of structure of array.
  8. Program to add two distances in feet and inches using structure.

Pointer programs

  1. Program to create, initialize, assign and access a pointer variable.
  2. Program to swap two numbers using pointers.
  3. Program to change the value of constant integer using pointers.
  4. Program to print a string using pointer.
  5. Program to count vowels and consonants in a string using pointer.
  6. Program to read array elements and print with addresses.
  7. Program to read and print student details using structure pointer, demonstrate example of structure with pointer.
  8. Program to print size of different types of pointer variables.
  9. Program to demonstrate example of double pointer (pointer to pointer).
  10. Program to demonstrate example of array of pointers.

Miscellaneous programs

  1. Program to get and set date in windows.
  2. Program to get remaindar without using % operator.
  3. Program to run dos commands through a C program.
  4. Program to convert ascii to integer (atoi implementation).
  5. Program to print ASCII table.
  6. Program to calculate total elapsed time by program/ function.
  7. Program to swap two numbers using four different methods.
Advance C Programs
  1. C program to design flying characters Screen Saver.
  2. C program to design a TIC TAC TOE game.
  3. C program to check given string is a valid IPv4 address or not.
  4. C program to convert String into Hexadecimal.
  5. C program to demonstrate example of Variable Arguments.
  6. C program to store time in an integer variable.
  7. C program to store date in an integer variable.
  8. C program to find the size of a file in Linux.
  9. C program to remove consecutive repeated characters from string.
  10. C program to get Process Id and Parent Process Id in Linux.
  11. C program to get current System Date and Time in Linux.
  12. C program to create your own header file.
  13. EMI Calculator (C program to calculate EMI).
  14. Age Calculator (C program to calculate age).
  15. C program to design love calculator.
  16. C program to guess a random number.
  17. C program to validate date (Check date is valid or not).
  18. C program to format/extract ip address octets.
  19. C program to implement substring function.
  20. C program to design a digital clock.
  21. C program to convert hexadecimal Byte to integer.
  22. C program to extract bytes from an integer (Hexadecimal) value.
  23. C program to print character without using format specifiers.
  24. C program to find Binary Addition and Binary Subtraction.
  25. C program to print weekday of given date.
  26. C program to implement gotoxy(), clrscr(), getch(), getche() for GCC, Linux.
  27. C program to calculate compound interest.