C Program to Compute Volume and Surface Area of Cylinder
Write C Program to Compute the Volume and the Surface Area of a Cylinder
//Write a C Program to Compute Volume and Surface Area of Cylinder #include <stdio.h> #define PI 3.14 int main() { float radius = 4, height = 5; double area_cylinder; //cylinder area formula area_cylinder = (2 * PI * radius * height) + (2 * PI * radius * radius); double volume; //cylinder volume formula volume = ( PI * radius * radius * height); printf("Surface area of Cylinder having radius %0.2f and height %.2f :--> %0.2f ", radius,height , area_cylinder); printf("\nVolume of Cylinder having radius %.2f and height %.2f :--> %.2f ",radius, height, volume); return 0; }
Output:
Surface area of Cylinder having radius 4.00 and height 5.00 :--> 226.08
Volume of Cylinder having radius 4.00 and height 5.00 :--> 251.20