programming-examples/c/Functions/C Program to Find the Volume and Surface Area of cylinder.c

18 lines
546 B
C
Raw Normal View History

2019-11-15 12:59:38 +01:00
/*
* C Program to Find the Volume and Surface Area of cylinder
*/
#include <stdio.h>
#include <math.h>
int main()
{
float radius, height;
float surface_area, volume;
printf("Enter value for radius and height of a cylinder : \n");
scanf("%f%f", &radius, &height);
surface_area = 2 * (22 / 7) * radius * (radius + height);
volume = (22 / 7) * radius * radius * height;
printf("Surface area of cylinder is: %.3f", surface_area);
printf("\n Volume of cylinder is : %.3f", volume);
return 0;
}