C Solved programs, problems with solutions – C programming

C Solved programs, problems with solutions


C Solved programs —->  C is a powerful general-purpose programming language. It is fast, portable and available in all platforms. If you are new to programming, C is a good choice to start your programming journey.

This page contains the C solved programs/examples with solutions, here we are providing most important programs on each topic. These C examples cover a wide range of programming areas in Computer Science.

Every example program includes the description of the program, C code as well as output of the program. All examples are compiled and tested on a Windows system.

These examples can be as simple and basic as “Hello World” program to extremely tough and advanced C programs. Here is the List of C solved programs/examples with solutions (category wise) and detailed explanation.


C Solved Programs by categories…….


C Basic Solved Programs
C Program to Print Hello World Program
C Program to calculate a simple interest
C program to convert Total days to year, month and days
C program to find Sum and Average of two numbers
C Program to check whether number is EVEN or ODD
C Program to find largest number among three numbers
C Program to calculate the AREA of rectangle
C program to calculate Gross Salary of an employee
C program to convert temperature from Fahrenheit to Celsius and vice versa
C Program to accept ten numbers and display sum of even and product of odd numbers
C Program to check the occurence of digit in a given number
C Program to find out the sum of first n numbers
C Program to generate a table of a given input number
C Program to check a triangle is a equilateral, isosceles or scalene
C Program to check whether character is vowel or not
C Program To find largest and smallest number and their positions
C Program to find the gross and net salary
C Program to find the roots of a quadratic equation
C Program To calculate area and circumference of the circle
C program to find the biggest and smallest of three numbers
C program to calculate x^n using pow function
C program to find the difference of two numbers
C Program to Print value in Decimal, Octal, Hexadecimal using printf
C program to print size of variables using sizeof () operator
C program to find HCF of two numbers
C program to multiply two numbers using plus operator
C program to demonstrate example of global and local scope
C program to convert feet to inches
C program to print ASCII value of entered character
C Program to input values into an array and display them
C Program to pass array elements to a function
C Program to pass array to function to calculate sum
C Program to print value and address of elements of an array without pointer
C Program to perform Call By Value and Call By Reference methods
C Program to display student details using structure members
C Program to understand how structure members sent to function
C Program to understand how structure variable returned from function

C Number Solved Programs
C Program to check whether number is palindrome or not
C Program to reverse a number entered by user
C Program to find Prime numbers between two Limits(Range)
C Program to display Armstrong numbers between Limits (Range)
C Program to check whether number is EVEN or ODD
C Program to find largest number among three numbers
C Program to accept ten numbers and display sum of even and product of odd numbers
C Program to find out the sum of first n numbers
C Program To find the biggest and smallest number and positions
C program to find the biggest and smallest of three numbers
C program to calculate x^n using pow function
C program to find the difference of two numbers
C program to find HCF of two numbers
C program to multiply two numbers using plus operator
C program to calculate Sum and Product of all digits of entered number
C program to check whether number is Prime or Not
C program to count total number of digits of an entered number
C program to count occurrence of a particular digit in a number
C program to check whether number is Perfect Number or not
C program to check whether number is Perfect Square or not
C program to find sum of numbers Series : 1+2+3+4+….+N
C program to find sum of Series : 1^2 + 2^2 + 3^2 + 4^2 + …. + N^2
C program to find the sum of Series: 1/1! + 2/2! + 3/3! + 4/4! +….+ N/N!
C program to find sum of series: 1+ 1/2 + 1/3 + 1/4 + 1/5 + ……….. + 1/N
C program to find sum of series:1 + 3^2/3^3 + 5^2/5^3 + 7^2/7^3 + … till N terms
C program to find Sum of series S=1+(1+2)+(1+2+3)+..….+(1+2+3+…+n)
C Program to evaluate the cosine series cos(x)
C Program to evaluate the sine series sin(x)
C Program to evaluate the exponential series exp(x)
C Program to convert IP address to 32-bit long int
C Program to accept list of numbers and display it in reverse order
C program to accept ten numbers and display lowest one
C Program to accept ten numbers and display largest one
C Program to find value of poly.f(x)=a4x4+a3x3+a2x2+a1x+a0 using Horner’s method
C program to calculate the GCD(HCF) of number
C program for finding remainder
C Program to find the prime numbers below a given number
C Program to find the perfect numbers below a given number
C Program for Fibonacci numbers
C Program to check input is prime number or not
C program to add two complex numbers
C program to generate random numbers
C program to find ncr and npr
C program to swap two numbers with third variable
C program to Swapping of two numbers without third variable
C Program to convert decimal number to Binary, Octal or Hexadecimal
C Program to display reverse number and find sum of digits
C Program to convert Number to String using Recursion
C Program to convert string of numbers to an integer using Recursion

C String Solved Programs
C Program to count length of string without using any library function
C Program to Count length of string using library function
C Program to compare two strings
C Program to reverse any string
C Program to find frequency of characters
C Program to concatenate two string
C Program to copy first string into second string
C Program to count number of vowels in string
C program to delete vowels from a string
C Program to reverse each words in string without reversing the characters
C Program to check whether string is palindrome or not
C Program to Compare two strings without using functions
C Program to Concatenating two strings without using functions
C Program to Converting string from lowercase to uppercase and vice-versa
C Program to Counting the number of words in a given string
C Program to Counting the number of character in a given string
C Program to Sort Elements in Lexicographical Order (Dictionary Order)
C Program to Remove all Characters in a String Except Alphabet
C Program to arrange the string in alphabetical order
C program to count uppercase, lowercase and special characters in string
C program to toggle each character in a string
C program to find number of alphabets, digits or special characters in a string
C program to count total number of vowels and consonants in a string
C program to find the first occurrence of a character in a string
C program to find last occurrence of a character in a string
C program to search all occurrences of a character in a string
C program to find maximum occurring character in a string
C program to find minimum occurring character in a string
C program to remove first occurrence of a character from string
C program to remove last occurrence of a character from the string
C program to remove all occurrences of a character from the string
C program to remove all repeated characters in a string
program to replace first occurrence of a character in a string
C program to replace last occurrence of a character in a string
C program to replace all occurrences of a character in a string
C program to trim leading white space characters in a string
C program to trim trailing white space characters in a string
C program to trim both leading and trailing white spaces in string
C program to remove spaces and blanks from a string
C Program to display reverse and length of string
C Program to find frequency of vowels in String
C Program to Replace occurence of character by another character
C Program to convert Number to String using Recursion
C Program to convert string of numbers to an integer
C Program to find all permutations of string

C Arrays Solved Programs
C Program To find largest and smallest number and their positions
C program to input and print n elements in an array
C program to find sum of all elements of an array
C program to find maximum and minimum element in array
C program to find second largest number in an array
C program to copy all elements of one array to another
C program to insert an element in array
C program to delete an element from an array
C program to print all unique element in an array
C program to print all negative elements in an array
C program to count even and odd elements in an array
C Program to sort an array in ascending order using bubble sort
C Program to sort an array in descending order using bubble sort
C program to count total number of negative elements in array
C program count total number of duplicate elements in an array
C program to delete all duplicate elements from an array
C program to count frequency of each element in an array
C program to merge two sorted array in ascending order
C Program to merge two sorted array in descending order
C program to find reverse of an array
C program to put even and odd elements of array in two separate array
C program to search an element in the array
C program to sort an array in ascending order
C program to sort an array in descending order
C program to sort even and odd elements of array separately
C Program to search an element in an array using Binary search
C Program to search an element in an array using linear search
C program to replace all Even elements by 0 and Odd by 1
C Program to Find Union & Intersection of 2 Arrays
C Program to implement Stack Operations Using Arrays
C Program to Implement a Queue using an Array
C Program to Calculate Addition of All Elements in Array
C Program to Merge Sort of two different arrays
C Program to find Mean, Variance and Standard deviation of n numbers
C program to find GCD(HCF) of N numbers using Arrays
C Program to input values into an array and display them
C Program to pass array elements to a function
C Program to pass array to function to calculate sum
C Program to print value and address of elements of an array without pointer
C Program to print value and address of elements of an array using pointer
C Program to enter Student Details using array of structures
C Program to understand arrays within structures
C Program to understand how array of structures sent to function

C Matrix Solved Programs
C program to add two matrices
C program to subtract two matrices
C program to perform Scalar matrix multiplication
C program to multiply two matrices
C program to check whether two matrices are equal or not
C program to find sum of main diagonal elements of a matrix
C program to find the sum of opposite diagonal elements of a matrix
C program to find sum of each row and columns of a matrix
C program to interchange diagonals of a matrix
C program to find upper triangular matrix
C program to find lower triangular matrix
C program to find sum of upper triangular matrix
C program to find transpose of a matrix
C program to find determinant of a matrix
C program to check whether a matrix is Identity matrix
C program to check sparse matrix
C program to check symmetric matrix
C Program to read and print a MxN Matrix
C Program to input a matrix and print diagonals
C program to calculate norm and trace of a matrix
C Program To find the sum of secondary diagonal of a Matrix
C Program To find the sum of primary diagonal of a Matrix
C Program to Interchange any two Rows & Columns in Matrix
C Program to Sort Rows in Ascending and Cols in Descendng Order
C Program to Find Frequency of Odd & Even Numbers in Matrix
C Program to Print Square of Each Element of Matrix

C Pattern Solved Programs
C program for Floyd’s triangle
C program to print Pascal triangle
C Program to Print Inverted Star Pyramid
C Program to Print Numbers in Pyramid
C Program to Print Double Inverted Pyramid Pattern
C Program to Print Binary Numbers Pattern
C Program to Print Pyramid of Multiplication Tables
C Program to Print Letters Pyramid
C Program to Print Number Pyramid
C Program to Print prime number Pyramid
C Number Pattern Programs in C Programming
C program to Print Heart Star Pattern using loops
C Program to Print pyramid of numbers using Recursion

C Sorting Solved Programs
C program to implement quick sort using Arrays
C Program to implement Merge Sort using Linked List
C Program to implement Bubble Sort using Array
C Program to implement Insertion Sort Using Linked List
C Program to implement Insertion Sort Using Arrays
C Program to sort the numbers using selection sort
C Program to Sort Numbers using Bubble Sort
C Program to Sort Array in an Ascending Order
C Program to Sort Names in an Alphabetical Order
C Program to Implement Selection Sort using Recursion
C to Implement Selection Sort using Functions
C Program to Perform Merge Sort using Recursion
C Program to Perform Quick Sort using Recursion
C to Sort Structures on basis of Structure Element
C Program to Sort strings in alphabetical order
C Program to Implement Postman Sort Algorithm
C Program to Sort Array using LSDRadix Sort
C Program to Sort an Array using Heap Sort
C Program to Sort an Array using Gnome Sort
C Program to Implement Pigeonhole Sort
C Menu Driven Program for Bubble, Selection and Insertion Sorting

C Recursion Solved Programs
C program to find sum of numbers Series : 1+2+3+4+….+N
C Program to Implement Selection Sort using Recursion
C Program to Implement Selection Sort using Functions
C Program to Perform Merge Sort using Recursion
C Program to Perform Quick Sort using Recursion
C program to Find power of a number using recursion
C program to calculate factorial using recursion
C Program to find GCD of a number using recursion
C Program to print Fibonacci series using Recursion
C Program to calculate the sum n natural number using recursion
C program to count digits of number using recursion
C program to calculate sum of digits using recursion
C program to calculate length of string using recursion
C Program to implement Tower Of Hanoi
C program to check number is palindrome or not
C Program for Depth First Search using Recursion
C Program to Traverse the Tree using Recursion
C Program to Reverse Stack using Recursion
C Program to Find Length of String using Recursion
C Program to Find Biggest Number in Array using Recursion
C Program to implement Matrix Multiplication using Recursion
C to Display Nodes of Linked List in Reverse using Recursion
C Program to Display all Nodes in Linked List using Recursion
C Program Count Occurrence of Element in Linked List using Recursion
C Program Find Length of Linked List using Recursion
C Program to implement Binary Search using Recursion
C Program to Reverse String using Recursion
C Program to find Reverse of Number using Recursion
C Program to Copy One to Another String using Recursion
C Program to Check whether String is Palindrome or not using Recursion
C Program to Find Number is Prime or Not using Recursion
C Program to Find LCM of Number using Recursion
C Program to find HCF of Number using Recursion
C Program to find Product of two Numbers using Recursion
C Program to Convert Decimal to Binary System using Recursion
C Program to find First Capital Letter in String using Recursion
C Program to find factorial by recursion and iteration methods
C Program to display numbers from 1 to n and their sum by recursion
C Program to convert decimal number to Binary, Octal or Hexadecimal
C Program to display reverse number and find sum of digits by recursion
C Program to raise float to power integer by Recursion and Iteration
C Program to print prime factors using Recursion and Iteration
C Program to check number is divisible by 11 and 9 using recursion
C Program to display reverse and length of string using Recursion
C Program to count prime numbers and display them using recursion
C Program to find whether number is perfect or not using recursion
C Program to Find sum of proper divisors of number using Recursion
C Program to Display a number in words using Recursion
C Program to perform Multiplication by Russian peasant method
C Program to calculate Base-2 and Base-N logarithm by recursion
C Program to calculate Binomial coefficient using Recursion
C Program to implement Ackermann function using recursion
C Program to find frequency of vowels in String using Recursion
C Program to Replace occurence of character by another character
C Program to Print pyramid of numbers using Recursion
C Program to convert Number to String using Recursion
C Program to convert string of numbers to an integer using Recursion
C Program to find all permutations of string by Recursion and Iteration

C Pointer Solved Programs
C Program to Access Elements of Array Using Pointer
C Program Swap Numbers Using Call by Reference
C Program to Find Largest Number Using Dynamic Memory Allocation
C Program to Read Infinite Numbers in Ascending Order
C program to swap two numbers using pointers
C Program to Reverse order of word in string using pointers
C Program to Reverse string using pointers
C Program To find maximum number using pointers
C program to find average of numbers using pointers
C program to sort numbers using pointers
C Program to check Palindrome Program using Pointer
C Program to Get Address of array using Pointers
C program to count consonants and vowels in string using pointer
C program to read and print student details using pointer
C program to print string using pointers
C program to print size of different data types using pointers
C program to perform double pointer
C program to perform array of pointers
C Program to implement Stack Operations Using Pointer
C Program to Find Length of String using Pointer
C Program to reverse array using Pointers
C Program to display array with addresses using pointers
C Program to Add Two Numbers Using Pointer
C Program to dereference pointer variables
C Program to show an example of pointer to pointer
C Program to print value and address of elements of an array using pointer
C Program to perform Call By Value and Call By Reference methods
C Program to return more than one value from a function
C Program for dynamic memory allocation using malloc( )
C Program to understand the use of realloc() function
C Program to understand pointers to structures
C Program to understand how pointer to structure variable is sent to function
C Program to understand how pointer to structure returned from function

C File Handling Solved Programs
C Program to write to file using fprintf() function
C Program to copy data from One file to Another file
C Program to read text file using File Handling
C Program to create file and store data using file handling
C Program to convert File to upper case using file handling
C Program to Count characters of file
C Program to append data to the file
C program to write student record to a file
C program read integers and appends sum to the end
C program to merge two files using file handling
C Program to read student details and store it in file
C Program To read text file and print it on screen
C program to compare data of two files in File Handling
C program to read last n characters of file
C Program Delete Line from text File
C Program to Replace specific Line in Text File
C Program to Find Size of File in File Handling
C Program to Create Employee and Update it
C Program to Replace First Letter with Capital Letter
C Program to Count Lines,Blank Lines,Comments in File
C Program to Convert text of File to LowerCase

C Graphic Solved Programs
C Program to perform Fish Movement in graphics
C Program to perform Pendulum in graphics
C Program to perform Car Movement using graphics
C Program to perform Chess Board using graphics
C Program to perform Bouncing Ball using graphics
C Program to perform Moving Wheel using graphics
C Program to Draw a Ellipse using graphics
C Program to Draw Line using Graphics
C Program to Draw Line using Bresenham’s Line Drawing Algorithm
C Program to Draw a Circle using Mid-Point Algorithm
C Program to Draw a Circle using Bresenham’s Circle Algorithm
C Program to perform 2D Transformations in Translations
C Program to perform 2D Transformations using Scaling
C Program to perform 2D Transformations in Rotation
C Program to Show the ticking Clock using Graphics
C Program to Hide Mouse Pointer using Graphics
C Program to draw Inductive Coil using Graphics
C Program to Draw Resistance using Graphics
C Program to Draw PNP Transistor using Graphics
C Program to Draw Eclipse using Graphics
C Program to Draw NPN Transistor using Graphics
C Program to Draw Capacitor using Graphics
C Program to Draw Triangle using Graphics
C Program to check if mouse support is available or not in Graphics
C Program to create house and perform operations in Graphics
C Program to draw rectangle & perform operations in Graphics
C Program to implement midpoint circle drawing algorithm in Graphics
C program to implement Moving Car in Graphics
C program to implement Rotation of wheel in Graphics
C program to implement Spiral Model in Graphics
C program to implement Bar Graph in Graphics
C Program to implement Kite flying in Graphics
C graphics program for analog clock in Graphics
C Program to implement 3-D rotation in Graphics

C Advance Solved Programs
C program to inject virus to restart PC
C Menu Driven Program for Towers of Hanoi and Binary Search
C Menu Driven Program for Student Details using File Handling
C Menu Driven Program to implement stack operations
C Program to perform Binary Search
C program to perform Tower of Hanoi Algorithm using Recursion
C program to convert input String(Text) to Morse Code
C Program to convert Prefix into INFIX Expression
C program to perform Priority Scheduling
C program to Perform Operator Precedence
C program for implementing Macro Processor
C program to perform First Come First Serve Algorithm
C Program to Maintain Inventory items in Online Store
C program to design flying characters Screen Saver
C program to implement a TIC TAC TOE game
C program to calculate age or Age Calculator
C program to design love calculator and calculate love percentage
C program to generate and guess random number
C program to check given string is valid IPv4 address or not
C program to convert String into Hexadecimal
C program to calculate EMI or EMI Calculator
C program to check date is valid or not (2 Methods)
C program to design a digital clock
C program to calculate Compound Interest
C program to calculate Binary Addition and Binary Subtraction

If you found any error or any queries related to the above programs or any questions or reviews , you wanna to ask from us ,you may Contact Us through our contact Page or you can also comment below in the comment section.We will try our best to reach up to you in short interval.


Thanks for reading the post….

4.3 32 votes
Article Rating
Subscribe
Notify of
guest
23 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
RêMõ

(using file handling)
Enter Country Name (Inida): india
5 states()
Enter Name of State : Rajasthan
Enter Name of capital : jaipur
show the menu of jaipur city:
1. check college in city :
2. check school Name:
Enter choice : 1
show list of all college in jaipur city(10):
college Name address contact no
Enter choice : 2
show list of all school in jaipur city(10):
school Name address contact no

Suresh Ahlay

Write a program that reads a list of integers until a stopping condition is met and then print each test score together
with Pass, if the score is greater than or equal to 60, and Fail otherwise.

mahesh minho

bro worst

mahesh minho

worst website

Mahedi Hasan

Write a C program to find the sum of contiguous sub array within an array which has the smallest
sum. Also print where in the array the smallest sum occurred.
For example, given the array [4, -1, 2, -3, 1, -2, 7, -5, 4], the contiguous sub-array [1, -3, -2] has the
smallest sum of -4 and it occurred in [0:6].
To understand contiguous sub array, given the array [1, 2, 3] the contiguous sub arrays are [1], [2],
[3], [1, 2], [2, 3], [1, 2, 3], but [1, 3] is not a contiguous sub array.
Sample Input
Sample Output

Malu

Consider an Auto spares store which has different categories of items like. Under each category, the shop holds a maximum capacity of 1000 items. The arrangement of items in the racks vary from time to time. Based on the item type and availability, the supplier also varies. Each supplier can supply different items. The system in the shopping mall has the complete description of list of all items which includes item number, name, category, supplier name, price, total quantity and qty available. Based on the items purchased by the customer, billing is done. From the above description, initially the owner… Read more »

pradip sapkale

#include<stdio.h>

int main()
{
 int  i;
 float avg=0sum=0 ,a[10];
 

 printf(“Enter 10 numbers”);
 for (i=0i<=9i++)
 scanf(%d, &a[i]);

 for (i=0i<=9i++);
{
 sum=sum+a[i];
 avgsum/10.0;
}
 printf(“average is %favg);

return 0;
}

the output averge is 0.00000
please help i’m beginer in c programming
using visual studio code

Sanskruti Jagdhane

Try with this code ..

#include<stdio.h>

int main()
{
 int a[20],i ,n ;
 float avg=0 , sum=0 ;

 printf(“Enter no of elements in array :\n “);
 scanf(“%d”, &n);
 printf(“\n Enter the array of element : \n”);

 for (i=1; i<=n; i++)
 {
   scanf(“%d”,&a[i]);
 }
  for (i=1; i<=n; i++)
  {
    sum=sum+a[i];
    avg= sum/n;
  }

 printf(“\n sum of elements :%f”,sum);
 printf(“\n average is %f”, avg);

return 0;
}

Akash

#include <stdio.h>
int main(){
/*Short and Sweet Code, Working code Please check inverted commas while running this code.*/

  int value[10];
  float Sum, Average;
  for(int i=0; i<=9; i++){
  printf(“Enter %d number: \n”, i+1);
  scanf(“%d”, &value[i]);
  }

  for(int i=0; i<=9; i++){

    Sum += value[i];
  
  }
Average = Sum/10;

printf(“Average of these 10 numbers is %f”, Average);  
  return 0;
}

Last edited 2 years ago by Akash
Akash

#include<stdio.h>
int main()
{
/*You have made 2 mistakes in this program.*/
 int  i;
 float avg=0, sum=0 ,a[10];
 
 printf(“Enter 10 numbers”);
 for (i=0; i<=9; i++)
 scanf(“%d“, &a[i]); /*ERROR 1: %d should be replaced with %f in your program because you declared a[10] as a float so you cannot use %d.*/

 for (i=0; i<=9; i++); /*ERROR 2: In this Loop Remove this semicolon after the brackets.*/
{
 sum=sum+a[i];
 avg= sum/10.0;
}
 printf(“average is %f“, avg);

/*After Doing this correction your program will run without giving error OR zero.*/

return 0;
}

Last edited 2 years ago by Akash
Md Forhad Ali

Plz Solve this Programe

256676832_4608769575897180_2595566630400619699_n.png
সত্যজিৎ

ভাই পেয়েছেন

Denn Martin Delizo

Interest is compounded annually at 10% by a certain bank. Make a program that would
input an amount and a number of years (the program should test that both are positive)
and output how much the original amount will be worth after that period.
 

Abhishek

Thank you

Basma

It’s really a wonderful website💥

ratta

The Business organization has a problem that they encounter. They received complains about the orders they have that are inaccurate mostly in selection of orders, prices, and quantity of the products. They want to have system update as soon as possible to fix this problem and asking for a refund. Every order must be confirmed to avoid any conflicts of transaction. Also the discounts are not applied when the order are wholesales which is needed to be fix when being total. Certain products are discounted either from a voucher or a wholesale that is minimum of five products. The deduction of… Read more »

Last edited 1 year ago by ratta
ratta

send help

Srija

To check whether the candidate is eligible for vote or not

Krishna mistry

(A) Create a C structure, volume with fields: liter and mililiter. Read the value of two volumes and add them, if the value of mililiter is more than 1000 then add it to liter value.

John

Write a c program for There are 20 workers working in a field. the owner of Field gives them 20 rupees. In that 20 rupees each man get 4 rupees each woman get 50 paise and each child get 25 paise. Then how many are men, women, children in that 20 workers?

Revathi

A vending machine questions

LARANYA SUBUDHI

1. Write a C program to print all odd numbers between 2 values ‘n’ and ‘m’. Read the values ‘n’ and ‘m’ from the user and print all the odd numbers in this range (inclusive range, i.e if ‘n’ or ‘m’ is odd, print those as well).

Basavaraj Metri

write a programming using for loop to print all the numbers from them as even m to n there by case classifying them as even or odd