Articles

# 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

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 height: 3
Total surface area is: 2137.14``````

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. Basic Python Programs

Would you like to see your article here on tutorialsinhand. Join Write4Us program by tutorialsinhand.com 