In this python program, we will learn how to calculate the volume and surface area of a cylinder.
Surface area of the Cylinder = 2πrh+2πr2
Here is the source code of the program to calculate the volume and surface area of a cylinder.
# Python Program to Calculate the Volume and Surface Area of a Cylinder
# Declare the Value of PI(π)
PI = 3.14
# Take the Input
radius = float(input("Enter the Radius of a Cylinder: "))
height = float(input("Enter the Height of a Cylinder: "))
# Surface area of the Cylinder
sa = 2 * PI * radius * (radius + height)
# Volume of the Cylinder
Volume = PI * radius * radius * height
# Lateral Surface Area of a Cylinder
L = 2 * PI * radius * height
# Bottom Surface Area of a Cylinder
T = PI * radius * radius
# Print the Output
print("\nThe Surface area of a Cylinder = %.2f" %sa)
print("The Volume of a Cylinder = %.2f" %Volume)
print("Lateral Surface Area of a Cylinder = %.2f" %L);
print("Top OR Bottom Surface Area of a Cylinder = %.2f" %T)
Enter the Radius of a Cylinder: 5
Enter the Height of a Cylinder: 8
The Surface area of a Cylinder = 408.20
The Volume of a Cylinder = 628.00
Lateral Surface Area of a Cylinder = 251.20
Top OR Bottom Surface Area of a Cylinder = 78.50
Comments