The best way to learn C programming is through practical exercises. This page contains some examples of basic concepts in C programming. It is recommended that you refer to the references in these examples and try to use them yourself. All the programs on this page have been tested and should run on all platforms.
Basic Examples of C Language
C "Hello, World!" Program
C program to print an integer (input by the user)
C program to add two integers
C program to multiply two floating-point numbers
C program to find the ASCII value of a character
C program for finding quotient and remainder
C program to find the size of int, float, double, and char
Demonstration of C program using the long keyword
A C program to swap two numbers
C Language flow control and loop instance
A C program to check if a number is even or odd
A C program to check if a character is a vowel or consonant
A C program to find the largest number among three numbers
A C program to find the roots of a quadratic equation
A C program to check if a year is a leap year
A C program to check if a number is positive or negative
A C program to check if a character is a letter
A C program to calculate the sum of natural numbers
A C program to find the factorial of a number
A C program to generate a multiplication table
A C program to display the Fibonacci sequence
A C program to find the GCD (greatest common divisor) of two numbers
A C program to find the LCM of two numbers
A C program uses a loop to display characters from A to Z
A C program to calculate the number of digits in an integer
A C program to reverse a number
A C program to calculate the power of a number
A C program to check if a number is palindrome
A C program to check if a number is prime
A C program to display prime numbers between two time intervals
A C program to check Armstrong numbers
A C program to display Armstrong numbers between two intervals
A C program to display the factors of a number
C Language function instance
A C program uses switch ... case to make a simple calculator
A C program to display prime numbers between intervals
A C program, to check for prime numbers or Armstrong numbers using user-defined functions
A C program to check if a number can be represented as the sum of two prime numbers
A C program uses recursion to find the sum of natural numbers
A C program uses recursion to find the factorial of a number
A C program uses recursion to find GCD
A C program to convert binary numbers to decimal
A C program to convert octal numbers to decimal
A C program to convert binary numbers to octal
A C program uses recursion to reverse a sentence
A C program uses recursion to calculate powers
C Language pointer and array instance
A C program to calculate the average using an array
A C program to find the maximum element in an array
A C program to calculate the standard deviation
A C program uses multidimensional arrays to add two matrices
A C program uses multidimensional arrays to multiply two matrices
A C program to find the transpose of a matrix
A C program to multiply two matrices by passing two matrices to the function
A C program uses pointers to access array elements
A C program uses reference calling to arrange numbers in a circular order
A C program uses dynamic memory allocation to find the maximum number
C Language string instance
A C program to find the frequency of characters in a string
A C program to calculate the number of vowels, consonants, etc.
A C program to delete all characters except letters in a string
A C program to find the length of a string
A C program to concatenate two strings
A C program to copy a string without using strcpy()
A C program sorts elements in dictionary order (dictionary order)
C Language structure instance
A C program to store student information
A C program uses 'structure' to add two distances (in inches)-in feet units)
A C program to add two complex numbers by passing structure to the function
C Program to Calculate the Time Difference Between Two Time Periods
C Program Using Structures to Store Student Information
C Program, Used to Dynamically Store Data in Structures
C Language File (I/O) Example
C Program to Write Sentences to a File
C Program to Read a Line from a File and Display It
C Program to Display Its Own Source Code as Output
C Program to Print Pyramid and Patterns