Math, asked by younex67, 11 months ago

Write a program in python to calculate volume of cylinder​

Answers

Answered by Equestriadash
102

The following codes must be typed in script mode, saved and then executed.

CODE 1:

pi = 3.14159r = int(input("Enter the radius of the cylinder:"))

h = int(input("Enter the height of the cylinder:"))

print("The volume of the cylinder is", pi*(r**2)*h)

OUTPUT:

\tt Enter\ the\ radius\ of\ the\ cylinder: 5

\tt Enter\ the\ height\ of\ the\ cylinder: 12

\tt The\ volume\ of\ the\ cylinder\ is\ 942.477

CODE 2:

r = int(input("Enter the radius of the cylinder:"))

h = int(input("Enter the height of the cylinder:"))

vol = 3.14159*r**2*h

print("The volume of the cylinder is", vol)

OUTPUT:

\tt Enter\ the\ radius\ of\ the\ cylinder: 5

\tt Enter\ the\ height\ of\ the\ cylinder: 12

\tt The\ volume\ of\ the\ cylinder\ is\ 942.477

Answered by Anonymous
9

Program to find the volume of the cylinder

A cylinder can be defined as the solid 3D object having two circular faces connected with the rectangular surface. The volume of the cylinder is the amount of space contained by it. The formula to calculate the volume of the cylinder is given below.

Formula

V=pie x r2 x h

where,

r is the radius of the cylinder

h is the height of the cylinder

V is the volume of the cylinder

Algorithm

Define the height of the cylinder.

Define the radius of the cylinder.

Calculate the volume of the cylinder pie x r2 x h

Define volume_cylinder and assign the volume of the cylinder to it.

Complexity

Similar questions