0% found this document useful (0 votes)
35 views

Computer Programming - I (MCT-143) Lab Session 3: Task 1

This document outlines 4 tasks for a C++ programming lab session: 1) Write a program to calculate the area and volume of a sphere given the radius. 2) Write a program to convert from Centigrade to Fahrenheit. 3) Write a program to display each digit of a 3-digit input number on a new line and calculate the sum. 4) Write a program to display the first of two integers entered as a percentage of the second. Sample outputs are provided for each task.

Uploaded by

Ahmed Sajid
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

Computer Programming - I (MCT-143) Lab Session 3: Task 1

This document outlines 4 tasks for a C++ programming lab session: 1) Write a program to calculate the area and volume of a sphere given the radius. 2) Write a program to convert from Centigrade to Fahrenheit. 3) Write a program to display each digit of a 3-digit input number on a new line and calculate the sum. 4) Write a program to display the first of two integers entered as a percentage of the second. Sample outputs are provided for each task.

Uploaded by

Ahmed Sajid
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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