C program to find the Surface Area and Volume of the Cylinder
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
total answers (1)
Read the radius and height of the cylinder from the user, and calculate the volume and surface area of the cylinder.
Cylinder volume formula: πr2h
Cylinder surface area formula: 2πrh+2πr2
Where, r is the radios and h is the height.
Program:
The source code to find the Surface Area and Volume of the cylinder is given below. The given program is compiled and executed using GCC compile on UBUNTU 18.04 OS successfully.
Output:
Explanation:
In the above program, we created three functions calcuateVolumeOfCylinder(), calcuateAreaOfCylinder(), and main(). The calcuateVolumeOfCylinder() function is used to calculate the volume of Cylinder based on given radius and hight. The calcuateAreaOfCylinder () function is used to calculate the surface area of Cylinder.
In the main() function, we read the value of the side of Cube from the user. Then we called the calcuateVolumeOfCylinder(), calcuateAreaOfCylinder() functions to calculate the volume and surface area of the Cylinder. After that, we printed the result on the console screen.
need an explanation for this answer? contact us directly to get an explanation for this answer