Untitled
unknown
plain_text
2 years ago
644 B
8
Indexable
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
float r, h;
printf("pls enter the base's radius of the cylinder:");
scanf("%f", &r);
printf("pls enter the height of the cylinder:");
scanf("%f", &h);
if (r, h <=0){
printf(" the height and radius must be a positive number!");
} else {
printf("the perimeter of base of the cylinder is:%f", 2*M_PI*r);
printf("\nthe area of base of the cylinder is:%f", M_PI*r*r);
printf("\nthe total surface are is:%f", h*2*M_PI*r+2* M_PI*r*r);
printf("\nthe volume of the cylinder is:%f", h*M_PI*r*r);
}
return 0;
}
Editor is loading...