You are on page 1of 1

Computer Programming – I (MCT-143)

Lab Session 3
Task 1:
Write a C++ program to find the area and volume of the sphere. The formulas of area and volume of
sphere are and
Sample output is:

This program calculates area and volume of the sphere.

Enter the radius: 4

Area of the sphere is A: 201.062

Volume of the sphere is V: 268.082

Task 2:
Write a C++ program to convert Centigrade into Fahrenheit. Formula is ( )
Sample output is:

This program converts centigrade into Fahrenheit.

Enter Centigrade Temperature: 37

In Fahrenheit it is: 98.6

Task 3:
Write a C++ program that will take a three digit number as input and will display three digits in a column
and also show their sum. (At present we can assume that user is sensible enough and will enter three digits
number. Later on in coming lab sessions we will see how to check that user has actually entered three digits
number and if it is not a three digits number, how to ask again for the number)
Sample output is:

Enter a three digits number: 432


4
3
2
4+3+2=9

Task 4:
Write a C++ program that will take two integers as input and will display first integer as a percentage of
other.
Sample output is:

Enter 1st integer: 20


Enter 2nd integer: 30
20 is 66.6667% of 30.

You might also like