C and C++ Programs

Sequential: Simple Logic Programs

Sum of two entered numbers

Average of three entered numbers

Simple interest

Total and Percent

Swapping values of two variables

Swapping without using third variable

Celsius to Fahrenheit conversion

Find area and circumference of circle

Branching: Selection Logic & Decision Making Programs

Absolute value of number (simple if)

Checking odd or even number (if else)

Checking leap year (if else)

Greater in two numbers (if else)

Finding grade from percent (else if ladder)

Total percent and division (else if ladder)

Greatest in three numbers (nested if)

Simple calculator program (switch case single case)

Switch between Mon to Sun (switch case single case)

Checking vowel or consonant (switch case multiple case)

Number of days in a month (switch case multiple case)

Looping: Iteration Logic or Repetition Logic Programs

Generate series of natural numbers (while, for, do while)

Generate series of natural numbers and their sum

Generate series of odd numbers and find their sum

Generate series of even numbers and find their sum

Generate table of given number

Find factorial of given number

Find power of given number

Generate multiplication table of given number

HCF and LCM of two numbers

Generating Fibonacci series

Checking prime number

Generating series of prime numbers

Sum of digits of given number

Reverse of digits of given number

Checking palindrome number

Checking Armstrong number

Generating series of Armstrong numbers

Convert decimal to binary

Convert binary to decimal

ASCII: Programs related to ASCII Table

Find ASCII values of a character

Convert lowercase to uppercase

Convert uppercase to lowercase

Pointer Example Programs

Declaration and assignment of pointer

Pointer to pointer

Sum of two numbers using pointer

Average of three numbers using pointer

Swapping two variables using pointer

Pointer Arithmetic

Array Example Programs

Declaration and initialization of array

Input-output in array

Sum and average of array elements

Largest Element in Array

Smallest element in Array

Reverse Elements of Array

Merging two arrays

Searching in array (Linear search)

Sorting in array (Selection sort)

Pointer to array

Matrix Example Programs

Transpose of Matrix

Addition of two matrix

Multiplication of two matrix

Sum of elements of matrix

Structure Example Programs

Declaration and initialization of structure

Array of structure

Pointer to structure

Union Example Programs

Declaration and initialization of union

Differentiate Structure and Union

String Example Programs

String input-output without space

String input-output with space

Strlwr() function example program

Strupr() function example program

Strlen() function example program

Strrev() function example program

Strcpy() function example program

Strcat() function example program

Strcmp() function example program

Function Example Programs

Sum of two numbers using function

Average of three numbers using function

Swapping using function call by value

Swapping using function call by reference

Passing array as function argument

Passing structure as function argument

Recursion Example Programs

Series of natural numbers

Table of number

Factorial of number

Power of number

Fibonacci series

File Example Programs

Writing to a file in C

Reading from a file in C

Appending to a file in C

Reading all data from a file in C

Pattern/Series Printing/Generating Programs

Asterisk Star Patterns

Alphabet Letter Patterns

Number Digit Patterns

Share it to: