C is a general-purpose procedural programming language mainly used for software development such as operating systems, compilers, language interpreters, databases, etc. The main features of C programming are speed and efficiency, modularity, portability, static typing, and extensibility. C programming is the perfect language for beginners to learn programming. This section contains many examples of C programming, from simple programs to very complex and advanced C programs.
These C Programming examples are categorized as data types, array, pointers, matrix, bitwise operations, control flow statements, math functions, file handling, factorial and Fibonacci series, palindrome, strings, searching, Sorting, etc. You can also explore a collection of data structure programs in trees, binary trees, heaps, linked lists, hash tables, graphs, stacks, and queues. Each sample program includes a program description, C code, and program output. All examples have been compiled and tested on Windows and Linux systems.
- Simple C Programs
- C Programs on Numbers
- C Programs on Date, Time & Year
- Special C Programs
- Factorial & Fibonacci Programs in C
- Pattern Programs in C
- Conversion Programs in C
- C Programs on Data Types & Union
- C Programs on Math Functions
- C Programs on Progression Series
- C Programs on Area and Volume
- C Programs on GCD, LCM & HCF
- C Programs on Array
- C Programs on Matrix
Simple C Programs
- Hello World Program in C
- C Program to Check Whether a Given Number is Even or Odd
- C Program to Find the Sum of Even and Odd Numbers
- C program to Check Whether a Number is Positive or Negative
- C program to Find the Largest Number Among Three Numbers
- C Program to Swap Two Numbers
- C Program to Find the Number of Integers Divisible by 5
- C Program to Check if Two Numbers are Equal
- C Program to Find Sum of Digits of a Number
- C Program to Find Sum of Digits of a Number using Recursion
- C Program to Increment by 1 to all the Digits of a Given Integer
- C Program that Takes Input as 2323 and Gives Output as 2332
- C Program to Find the Sum of Each Row and Column of a Matrix
- C Program to Print Multiplication Table
- C Program to Read a Grade and Display the Equivalent Description
- C Program to Input 3 Arguments and Operate Appropriately on the Numbers
- C Program to Count the Number of Vowels and Consonants in a Sentence
- C Program to Count No of Lines, Blank Lines, and Comments in the Program
- C Program to Convert Lowercase Characters by Uppercase and Vice-Versa
- C Program to Accept the Height of a Person & Categorize as Taller, Dwarf & Average
- C Program to Print Environment Variables
- C Program to Print the Program Name and All its Arguments
C Programs on Numbers
- C Program to Find Prime Numbers in a Given Range
- C Program to Check Prime Number
- C Program to Check whether a Number is Prime or Not using Recursion
- C Program to Check Whether a Given Number is Perfect Number
- Strong Number Program in C
- C Program to Check Armstrong Number
- C Program to Print Armstrong Number between 1 to 1000
- C Program to Find Nth Armstrong Number
- C Program to Find Sum of First N Natural Numbers
- C Program to Find Sum of Natural Numbers using Recursion
- C Program to Find the Sum of First 50 Natural Numbers using For Loop
- C Program to Reverse a Number
- C Program to Reverse a Number and Check if it is a Palindrome
- C Program to Reverse a Number using Recursion
- C Program to Add Two Numbers
- C Program to Add Two Binary Numbers
- C Program to Multiply Two Binary Numbers
Special C Programs
- C Program without using the Main() Function
- C Program to Print Statement without Semicolon
- C Program to Print Semicolon without using Semicolon
- C Program to Display its own Source Code as Output
- C Program to Display the ATM Transaction
- C Program to Calculate EMI
- C Program to Calculate Electricity Bill
- Fizzbuzz Program in C
- C Program to Get IP Address
- C Program to Illustrate how User Authentication is Done
- C Program to Shutdown Computer in Linux
Factorial & Fibonacci Programs in C
- Fibonacci Series Program in C
- C Program to Find First N Fibonacci Numbers
- C Program to Find Nth Fibonacci Number using Recursion
- C Program to Compute First N Fibonacci Numbers using Command Line Arguments
- C Program to Generate Fibonacci Series using Command Line Argument
- C Program to Find the Factorial of a Number
- C Program to Find the Factorial of a Number using Recursion
Conversion Programs in C
- C Program to Convert Binary to Decimal
- C Program to Convert Binary to Hexadecimal
- C Program to Convert Binary to Octal
- C Program to Convert Binary to Gray Code using Recursion
- C Program to Convert Binary to Gray Code without Recursion
- C Program to Convert Octal to Binary
- C Program to Convert Octal to Decimal
- C program to Convert Decimal to Hexadecimal
- C program to Convert Decimal to Octal
- C Program to Convert Decimal to Binary using Recursion
- C Program to Convert Decimal to Binary and Count the Number of 1s
- C Program to Convert Hexadecimal to Binary
- C Program to Convert Numbers to Roman Numerals
- C Program to Convert Roman Number to Decimal Number
- Temperature Conversion Program in C
- C program to Convert Fahrenheit to Celsius
- C Program to Convert Celsius to Fahrenheit
C Programming Examples on Math Functions
- C Program to Calculate the Value of sin(x)
- C Program to Calculate the Value of cos(x)
- C Program to Calculate the Sum of cos(x) Series
- C Program to Find Quotient and Remainder
- C Program to Find the Roots of a Quadratic Equation
- C Program to Find Square Root of a Number
- C Program to Read Coordinate Points and Determine its Quadrant
- C Program to Find Simple Interest
- C Program to Find Compound Interest
- C Program to Simulate a Simple Calculator
- C Program to Calculate the value of nCr
- C Program to Calculate the value of nPr
- C Program to Evaluate the Given Polynomial Equation
- C Program to Find Mean, Variance and Standard Deviation
- C Program to Add Two Complex Numbers
- C Program to Find Power of a Number
- C Program to Calculate Pow (x,n)
C Programming Examples on Progression Series
- C program to Find the Sum of Arithmetic Progression Series
- C program to Find the Sum of Geometric Progression Series
- C program to Find the Sum of Harmonic Progression Series
- C Program to Find Sum of Series 1 + 1/2 + 1/3 + 1/4 + ……. + 1/N
- C Program to Find Sum of Series 1^2 + 2^2 + …. + n^2
- C Program to Find Sum of Series 1^3 + 2^3 + 3^3 + … + n^3
- C Program to Find Sum of the Series 1/1! + 2/2! + 3/3! + ……1/N!
C Programs on Area and Volume
- C Program to Find the Area of a Circle
- C Program to Find the Area of a Triangle
- C Program to Find Area of Parallelogram
- C Program to Find Area of Rhombus
- C Program to Find Area of Trapezium
- C Program to Find Area of a Right Angled Triangle
- C Program to Find the Area of Different Geometrical Shapes
- C Program to Find Volume and Surface Area of Cone
- C Program to Find Volume and Surface Area of Cuboid
- C Program to Find Volume and Surface Area of Cylinder
- C Program to Find Volume and Surface Area of Sphere
- C Program to Find Volume and Surface Area of a Cube
- C Program to Find the Perimeter of a Circle, Rectangle and Triangle
C Programs on Array
- C Program to Find the Number of Elements in an Array
- C program to Delete an Element from an Array
- C Program to Find Sum of Array Elements using Pointer
- C Program to Print all Non Repeated Elements in an Array
- C Program to Cyclically Permute the Elements of an Array
- C Program to Find Missing Numbers in Array
- C Program to Find Union and Intersection of Two Arrays
- C Program to Split the Array and Add First Part to the End
- C Program to Implement Bit Array
- C Program to Implement Variable Length Array
C Programming Examples on Matrix
- C Program to Perform Matrix Multiplication
- C Program to Display Upper Triangular Matrix
- C Program to Find Transpose of a Matrix
- C Program to Find Determinant of a Matrix
- C Program to Implement Adjacency Matrix
- C Program to Find the Frequency of Odd and Even Numbers in Matrix
- C Program to Find Normal and Trace of a Matrix
- C Program to Interchange Any Two Rows and Columns in the Matrix
C Programs on Bitwise Operation
- C Program to Perform Addition using Bitwise Operators
- C Program to Check whether the Given Integer has an Alternate Pattern
- C Program to Check if Bit Position is Set to One or not
- C Program to Check whether nth Bit is Set or not
- C Program to Count Trailing Zeros in Integer
- C Program to Round Floor of Integer to Next Lower Power of 2
- C Program to Find the Highest Bit Set for any Given Integer
- C Program to Reverse All Bits of an 32-bit Integer using Bitwise
- C Program to Find MSB Position using Function
C Programs on Strings
- C program to Compare Two Strings
- C Program to Delete All Repeated Words in String
- C Program to Replace all Characters by Lowercase
- C Program to Find the Frequency of a Substring in a String
- C Program to Count Number of Unique Words in a String
- C Program to Find All Possible Subsets of a String
- C Program to Print Ascii Value of All Characters in the String
- C Program to Find First and Last Occurrence of Character in a String
- C Program to Implement Regular Expression Matching
- C Program to Implement strpbrk() Function
Palindrome Programs in C
- C Program to Check Whether a Number is Palindrome or Not
- C Program to Check if a given String is Palindrome
- C Program to Check whether two Strings are Anagrams
- C Program to Check whether a String is Palindrome or not using Recursion
- C Program to Check if a String is a Palindrome without using Built-in Function
- C Program to Find the Largest & Smallest possible Word which is a Palindrome
- C Program to Find Smallest and Biggest Possible Word which is Palindrome in a String
C Programming Examples on File Handling
- C Program to Create a File and Store Information
- C Program to Count the Number of Lines in Text File
- C Program to Convert the Content of File to Lowercase
- C Program to Capitalize First Letter of Each Word in a File
- C Program to Replace a Specific Line in a Text File
- C Program to Delete a Specific Line from File
- C Program to Create Employee Record System using File Handling
- C Program to Display the Inventory of Items in a Store
C Programs on Recursion
- C Program to Find Sum of N Numbers using Recursion
- C Program Find the Length of Linked List without Recursion
- C Program to Find the Height of Tree using Recursion
- C Program to Find the Length of the String
- C Program to Reverse a Stack using Recursion
- C Program to Perform Binary Search using Recursion