Write a program to find the volume of cube cuboid cone and cylinder using a user defined function volume
Answers
Answer:
CUBE - SIDE*SIDE*SIDE
CUBOID - LENGTH*BREADTH*HEIGHT
CYLINDER - 2*PI*R*R*H
Program to find the volume of cube cuboid cone and cylinder
Output:
Enter the side of cube: 4
Enter the length of cuboid: 6
Enter the breath of cuboid: 5
Enter the height of cuboid: 4
Enter Radius of cylinder: 5
Enter height of cylinder: 6
Enter the radius of cone: 3
Enter the height of cone: 9
volume of cube: 64
volume of cuboid: 120
volume of cone: 84.85714285714285
volume of cylinder: 471.0
Explanation:
Following are the program in the Python Programming Language.
#define function
def volume():
a=int(input("Enter the side of cube: "))
l=int(input("Enter the length of cuboid: "))
b=int(input("Enter the breath of cuboid: "))
h=int(input("Enter the height of cuboid: "))
r=int(input("Enter Radius of cylinder: "))
h1=int(input("Enter height of cylinder: "))
r1=int(input("Enter the radius of cone: "))
h2=int(input("Enter the height of cone: "))
cuboid=l*b*h
cone=(1.0/3) * (22 / 7) * r1 * r1 * h2;
cylinder=3.14*(r*r)*h1
cube=a*a*a
print("\n")
print("volume of cube: ",cube)
print("volume of cuboid: ", cuboid)
print("volume of cone: ",cone)
print("volume of cylinder: ", cylinder)
#calling of the function
volume()
Following are the description of the program.
We define the function "volume" and inside the function "volume".
- Set variable "a" and get input from the user to find the volume of a cube.
- Set variables "l" for length, "b" for breath, and "h" for height to find the volume of a cuboid.
- Set variables "r" for radius and "h1" for height to find the volume of the cylinder.
- Set variables "r1" for radius and "h2" for height to find the volume of the cone.
- Then, print the volume of cube, cuboid, cone, and cylinder.
Finally, we call the following function "volume".
Learn more:
Write a program to find volume of a cube : https://brainly.in/question/10283551