Program to calculate total surface area of a cylinder in Python
In this python programming tutorial, we will learn to write,
-
python program to calculate total surface area of a cylinder
Program to calculate total surface area of a cylinder in Python
The python program to calculate total surface area of a cylinder is as follows:
# Owner : TutorialsInhand Author : Devjeet Roy
r = float(input('Enter radius: '))
h = float(input('Enter height: '))
csa = (2 * 22 * r * h) / 7
esa = (2 * 22 * (r ** 2)) / 7
tsa = csa + esa
print("Total surface area is:",round(tsa,2))
The output of the program to calculate total surface area of a cylinder in python is as follows:
PS C:\Users\DEVJEET\Desktop\tutorialsInHand> python code.py
Enter radius: 17
Enter height: 3
Total surface area is: 2137.14
Few important tips about this program:
1. In the given program, first we ask the users to enter the radius and height of the cylinder, we convert that to float data type.
2. Then we find the Curved Surface Area (csa) and End Surface Area (esa).
3. Finally, we add this two, to get the total surface area (tsa).
4. We have used the round() function to round off the answer upto the second decimal place.
Would you like to see your article here on tutorialsinhand.
Join
Write4Us program by tutorialsinhand.com
About the Author
Devjeet Roy
Full Stack Web Developer & Blockchain Enthusiast
Page Views :
Published Date :
Feb 02,2021