Skip to content

Practice programs for C language

Questionnaire for C programming

 Programs based on If-Else

  1. C program to find the greatest number among three numbers.
  2. C program to find out whether a given year is a leap year or not.
  3. C program to convert temperature from Fahrenheit to Celsius and Celsius to Fahrenheit.
  4. C program to check sign of a given number.
  5. C program to check whether triangle is equilateral, scalene or isosceles.
  6. C program to check whether the triangle is valid or not if sides are given.
  7. C program to enter student marks and find percentage and grade. A college has the following rules for grading system:1. Below 25 – F
    2. 25 to 45 – E
    3. 45 to 50 – D
    4. 50 to 60 – C
    5. 60 to 80 – B
    6. Above 80 – Ask the user to enter mark of 5 subjects and print the corresponding grade.
  8. Write a C program to input basic salary of an employee and calculate gross salary according to given conditions.
    Basic Salary <= 10000 : HRA = 20%, DA = 80%
    Basic Salary is between 10001 to 20000 : HRA = 25%, DA = 90%
    Basic Salary >= 20001 : HRA = 30%, DA = 95%

Programs based on Loops

  1. C program to print all natural numbers from 1 to n using while loop.
  2. C program to print natural numbers in reverse from n to 1 using while loop.
  3. C program to print alphabets from a to z using while loop.
  4. C program to print all odd numbers from 1 to n using for loop.
  5. C program to print multiplication table of a given number using for loop.
  6. C program to print multiplication table from 1 to 5 using Nested loop.
  7. Program to add numbers until the user enters zero using do..while loop.
  8. C program to find factorial of a number.
  9. C program to find all factors of a number.
  10. C program to check whether a number is palindrome or not.
  11. C program to reverse order of words in a string.
  12. C program to count frequency of digits in an integer.
  13. C program to count number of digits in an integer.
  14. C program to swap first and last digit of a number.

Programs based on Arrays

  1. Merge two arrays of same size sorted in descending order.
  2. Count the frequency of each element of an array.
  3. Sort elements of array in ascending order.
  4. Insert New value in the array (sorted list).
  5. Delete an element at desired position from an array.
  6. Addition of two Matrices.
  7. Multiplication of two Matrices.
  8. Transpose of a Matrix.
  9. Find the missing number from a given array.
  10. Find two elements whose sum is closest to zero.

Programs based on Pointers

  1. Program in C to demonstrate how to handle the pointers in the program.
  2. Program to add two numbers using call by reference.
  3. Generate permutations of a given string.
  4. Store and retrieve elements from an array.
  5. Calculate the length of the string.
  6. Find the factorial of a given number.
  7. Sort an array using pointer.
  8. Show a function returning pointer.
  9. Sum of all elements in an array.
  10. Print all the alphabets.

Programs based on Switch-case

  1. C program to find all roots of a quadratic equation using switch case.
  2. C program to create calculator using switch case.
  3. Consider the following program which the user to type his own ID, if the ID is valid it will ask him to enter his password, if the password is correct the program will print the name of the user, otherwise, the program will print Incorrect Password and if the ID does not exist , the program will print Incorrect ID.

Programs based on Structures

  1. Program to Store Information of a Student Using Structure.
  2. Program to Add Two Distances (in inch-feet system) using Structures.
  3. Program to Add Two Complex Numbers by Passing Structure to a Function.
  4. Program to Calculate Difference Between Two Time Periods.
  5. Program to Store Information of Students Using Structure.
  6. Program to Store Data in Structures Dynamically.

Click on the links attached with the topics to see the solutions.

Leave a Reply

Your email address will not be published. Required fields are marked *