Write a C program to accept dimensions of a cylinder and display the surface area and
volume of cylinder.
#include <stdio.h>
int main() {
      float radius, height, volume, area;
    printf("Enter cylinder radius: ");
    scanf("%f", &radius);
    printf("Enter cylinder height: ");
    scanf("%f", &height);
    volume = 3.14 * (radius * radius) * height;
    area = 2 * 3.14 * radius * (radius + height);
    
    printf("\n\n");
    printf("Surface area: %.3f\n", area);
    printf("Volume of cylinder: %.3f\n", volume);    
}
Comments