C Programs
1. Temperature Converter: Write a C program that converts a temperature in
Fahrenheit to Celsius. Prompt the user to enter a temperature in Fahrenheit, then
convert it to Celsius using the formula: Celsius = (Fahrenheit - 32) * 5 / 9. Use
appropriate variable names, data types, and printf statements to display the result with
proper formatting. Include comments to explain each step of the program.
2. Simple Calculator: Create a basic calculator in C that performs addition, subtraction,
multiplication, and division. Prompt the user to enter two numbers and an operator (+,
-, *, /). Perform the corresponding operation and display the result using printf
statements. Use constants to represent the operators and include comments to describe
the program logic.
3. Circle Area and Circumference Calculator: Write a C program that calculates the
area and circumference of a circle. Prompt the user to enter the radius of the circle,
then calculate and display the area and circumference using appropriate variables and
data types. Use comments to explain the calculations and printf statements to display
the results.
4. Simple Interest Calculator: Create a program that calculates the simple interest on a
loan. Prompt the user to enter the principal amount, interest rate, and time period in
years. Calculate the simple interest using the formula: Simple Interest = (Principal *
Rate * Time) / 100. Display the result with proper formatting using printf statements
and include comments to explain the calculations.
5. BMI Calculator: Develop a C program that calculates the Body Mass Index (BMI) of
a person. Prompt the user to enter their weight in kilograms and height in meters.
Calculate the BMI using the formula: BMI = weight / (height * height). Display the
BMI result along with an appropriate message indicating the person's BMI category
(e.g., underweight, normal weight, overweight) using printf statements. Include
comments to explain the BMI categories and calculations.
6. Grade Calculator: Write a C program that calculates the average of three grades
entered by the user. Prompt the user to enter three grades, calculate the average, and
display it using printf statements. Use appropriate variable names and data types for
grades and include comments to explain the program logic.
7. Simple Number Guessing Game: Develop a simple number guessing game in C.
Generate a random number between 1 and 100 and ask the user to guess the number.
Provide hints (higher/lower) to help the user guess correctly. Use printf statements to
prompt the user for input and display messages. Use comments to describe the game's
logic and variables.
8. Sum of Digits Calculator: Create a C program that calculates the sum of digits of a
three-digit number entered by the user. Prompt the user to enter a three-digit number,
then extract and sum the individual digits. Display the sum using printf statements and
include comments to explain each step of the calculation.
9. Leap Year Checker: Write a program in C that checks if a year entered by the user is
a leap year. Prompt the user to enter a year and use printf statements to display
whether the year is a leap year or not. Include comments to explain the leap year logic
and the use of constants.