learn C programming from examples. The list of c programs includes the various C’s concept such as functions, loops, structures, variables, pointers, string, array, etc.


  1. Reverse a String
  2. Palindrome string
  3. String Array
  4. Sort String array in Alphabetical Order
  5. Remove Duplicate Characters in a String
  6. Count Vowels and Consonants
  7. Remove Vowels from String
  8. Concatenate Two Strings


  1. Palindrome Number
  2. Armstrong Number
  3. Neon Number
  4. Magic Number
  5. Perfect Number
  6. Strong Number
  7. Automorphic Number
  8. Fascinating Number
  9. Harshad Number
  10. Swap 2 Numbers without using 3rd Variable
  11. Minimum Prime Factor
  12. Display Factors of a Number


  1. Check Leap Year
  2. Factorial of a Number
  3. Prime Numbers From 1 to N
  4. Find LCM of Two Numbers
  5. Find LCM of Array of Numbers
  6. Find GCD of Two Numbers
  7. Find GCD of Array of Numbers

Number Conversion

  1. Decimal to Binary
  2. Binary to Decimal
  3. Decimal to Octal
  4. Octal to Decimal


  1. Reverse Array without Using another Array
  2. Delete Duplicate Elements in an Array
  3. Find Second Largest in an Array
  4. Merge Two Sorted Arrays into One
  5. Insert Element at nth Position


  1. Matrix addition in C
  2. Matrix addition using the linked list
  3. Matrix multiplication in C
  4. Transpose of Matrix
  5. Check for Identity Matrix
  6. Minimum in Row and Maximum in Column
  7. Search Element in 2D array
  8. Smallest and Largest Element of the Diagonals


  1. Tower of Hanoi using Recursion
  2. Fibonacci Series in C


  1. Read and Print Employee Details using Structure
  2. Read and Print Student Details using Structure


  1. Multiple Patterns Programs in C
  2. Pascal’s Triangle

Command Line Arguments

  1. Binary to Decimal using Command Line Argument

The best way to learn to program is by practicing on your own. So we recommend you to code on your own after reading our programming examples.

To Practise C programming you will need a text editor and a c/c++ compiler. If you don’t have that, you can download the Dev-C++ IDE to run your c or c++ source code on your machine.

You can also code C language online using an online platform like repl.it which is absolutely free.

Unlike C++, Java, and Python – C is not an object-oriented programming language so for a newbie it is the best language to learn because knowing the logic of how the code works and runs? is more important than learning cool complex features of OOP.

So let’s start with Hello World Program in C.

#include <stdio.h>
int main(void) {
  printf("Hello World\n");
  return 0;

Output: Hello World

If you are not familiar with the basic concepts of c language then don’t worry. Let’s Learn C together.

Basics of C Language

The smallest fundamental unit of the C program is known as Token. For example, if you break down c programs into smaller parts, the smallest to have some meaning or significance is considered as a Token.

Example: if, for, int, main, return, ;, +, -, class, #, myVariable, etc.

The main types of Tokens in C are:

  1. Keywords: These are the words that are reserved for special purpose in C language e.g default. switch, if, class, char, int, etc.
  2. Operators: These types of tokens in C are basically use to perform mathematical or logical operations e.g +, -, ||, & etc.
  3. Identifiers: These are the names given to program elements such as array, variable, function to identify them for use e.g student_id, add, roll_no etc.
  4. Constants: These are the types of tokens whose values remains fixed through out the program. It can be of two types:
    1. Numeric Constant: such as const int num = 2.
    2. Character constant: such as ‘\n’, ‘\b’.

Variables in C

A variable is named storage which can hold single or more values.


#include <stdio.h>
int main(void) {
  int x=4, y=5;
  return 0;

The above program output 9. x and y are variables that are used to store 4 and 5 respectively.

Now variables in C can be of two types:

  1. Local Variable
  2. Global Variable

A local variable is a variable whose value is confined to a particular scope or function and a global variable can be accessed or modified throughout the program.