C programming Practice problem_2
C programming Practice problem_2
Practice Problems
1. Write a C program to convert inches to the centimeter. Take input or inches from the end-user
using the scanf function.
2. Write a program to find the circumference and the area of a circle. Take the radius of the circle
as input from the user.
3. Write a C program to find the sum and average of three numbers. Take inputs from the end-user.
4. Write a C program to find the area and volume of a cylinder. by taking the radius and height as
input from the user.
5. Formula:-
V = area * h
Or, V = π*r²*h
6. Read the amount of money and determine the minimum number of notes required.
7. Write a C program to check whether the given number is of multiple of 7 or not.
8. Write a program to check whether the given number is positive or negative or zero.
9. Find the largest of the 3 numbers using if-else.
10. Write a program to check whether the candidate is eligible for voting or not by accepting the age
value from the user.(age should be at least 18)
11. Write a C program to evaluate the result of a student by accepting marks in three subjects. If any
subject mark is less than 35 then the student is failing. For average greater than equal to 60, the
student is first-class else it is 2nd class. If the student does not fail then also display the total
mark and average mark.
12. Write a program that performs basic arithmetic operations (+, -, *, /) based on user input. Use a
switch case to handle the operations.
Input: Operator (+, -, *, /) and two numbers.
Output: Result of the operation.
13. Create a program to categorize grades using the following system:
A: 90-100
B: 80-89
C: 70-79
D: 60-69
F: Below 60
Use switch-case to map numeric ranges to letter grades.
Input: 85
Output: Grade: B
14. Write a program that determines the season based on the month number using switch case:
12, 1, 2: Winter
3, 4, 5: Spring
6, 7, 8: Summer
9, 10, 11: Fall
Input: 3
Output: Spring
15. Write a program to check if a given character is a vowel or consonant using switch case.
Input: A
Output: Vowel
16. Create a program with a menu offering the following options using switch case:
Add two numbers
Subtract two numbers
Multiply two numbers
Divide two numbers
Exit
17. Write a program to calculate the area of different shapes using switch case:
1: Circle
2: Rectangle
3: Triangle
Input the shape type and its dimensions, and use switch-case to calculate the area.
Input: 1 (Circle, radius = 5)
Output: Area: 78.5