C Programs
C Programs
1. Write a program that asks the user to input length (l), breadth (b) and height (h) of the
cuboid. Calculate and display its volume and total surface area.
[𝐻𝑖𝑛𝑡: 𝑉 = 𝑙 × 𝑏×ℎ, 𝑇𝑆𝐴 = 2(𝑙𝑏 + 𝑏ℎ + 𝑙ℎ)]
2. Write a program to read the side (a) of a cube. Calculate and display its volume and surface
area. [𝐻𝑖𝑛𝑡: 𝑉 = 𝑎3, 𝑇𝑆𝐴 = 6𝑎2]
3. Write a program to input principal (P), time (T) and rate (R). Calculate and print the simple
𝑃×𝑇×𝑅
interest. 𝐻𝑖𝑛𝑡: 100
4. Write a program to get the radius (r) of the circle and display its area and circumference.
[𝐻𝑖𝑛𝑡: 𝐴 = π𝑟2, 𝐶 = 2π𝑟]
2
5. Write a program to calculate volume and total surface area of the hemisphere. [𝐻𝑖𝑛𝑡: 3 𝜋𝑟 3 ,
𝑇𝑆𝐴 = 3𝜋𝑟 2]
6. Write a program to convert IC (Indian Currency) into NC (Nepali Currency).
7. Write a program that prompts the user to enter a number and an exponent (power). The
program should calculate and display the result of raising the number to the given power.
8. Write a program to get temperature in Celsius(C) from the user and then print the
9𝐶
temperature in Fahrenheit. 𝐻𝑖𝑛𝑡: 𝐹 = + 32
5
9. Write a program to input the number of days and convert into years, months and days.
[Given: 1 year=360 days, 1 month=30 days]
10. Write a program to read perpendicular (p) and base (b) of a right angled triangle, then find its
hypotenuse (h).𝐻𝑖𝑛𝑡: ℎ = √𝑝2 + 𝑏 2
11. Write a program to input any three numbers and display the greatest one.
12. Write a program to input any three different numbers and display the middle number.
13. Write a program to input the length of the sides of a triangle and determine whether the
triangle is equilateral, isosceles or scalene. Hint: equilateral=all sides equal, isosceles=any
two sides equal and scalene=none of the sides equal
14. Write a program to input the length of the sides of a triangle and determine whether the
triangle can be formed or not. Hint: To form a triangle, the sum of any sides should be
greater than the third side
15. Write a program that asks the user to input the name and marks on the computer (FM-100).
The program should display the grade and grade point as follows:
Obtained Mark Grade Grade Point
>=90 A+ 4.0
>=80 and <90 A 3.6
>=70 and <80 B+ 3.2
>=60 and <70 B 2.8
>=50 and <60 C+ 2.4
>=40 and <50 C 2.0
>=35 and <40 NG -