;

Python Program to Calculate the Volume and Surface Area of a Cone


Tutorialsrack 13/05/2020 Python

In this python program, we will learn how to calculate the volume and surface area of a cone. In this program, we will use the python built-in math.sqrt() function to calculate the square root of the number and this math.sqrt() function belongs to the math module of the python.

What is Cone?

A cone is a three-dimensional geometric shape that tapers smoothly from a flat base to a point called the apex or vertex. A cone is formed by a set of line segments, half-lines, or lines connecting a common point, the apex, to all of the points on a base that is in a plane that does not contain the apex.

Formula 

Here is the source code of the program to calculate the volume and surface area of a cone.

Python Program to Calculate the Volume and Surface Area of a Cone
# Python Program to Calculate the Volume and Surface Area of a Cone

# Import Module
import math

# Take the Input From the User
radius = float(input("Enter the Radius of a Cone: "))
height = float(input("Enter the Height of a Cone: "))

# Calculate Length of a Slide (Slant)
l = math.sqrt(radius * radius + height * height)

# Calculate the Surface Area
SA = math.pi * radius * (radius + l)

# Calculate the Volume
Volume = (1.0/3) * math.pi * radius * radius * height

# Calculate the Lateral Surface Area
LSA = math.pi * radius  * l

# Print the Output
print("\nLength of a Side (Slant)of a Cone = %.2f" %l)
print("The Surface Area of a Cone = %.2f " %SA)
print("The Volume of a Cone = %.2f" %Volume);
print("The Lateral Surface Area of a Cone = %.2f " %LSA)
Output

Enter the Radius of a Cone: 6

Enter the Height of a Cone: 10

 

Length of a Side (Slant)of a Cone = 11.66

The Surface Area of a Cone = 332.92 

The Volume of a Cone = 376.99

The Lateral Surface Area of a Cone = 219.82


Related Posts



Comments

Recent Posts
Tags