C : Program for making cylinder calculator
Oct 21, 2023
Program :
//c program for making cylinder calculator
#include<stdio.h>
float curved_surface_area(float r, float h)
{
return 2*3.14159265359*r*h;
}
float total_surface_area(float r, float h)
{
return 2*3.14159265359*r*(r+h);
}
float volume_cyl(float r, float h)
{
return 3.14159265359*r*r*h;
}
int main()
{
float radius, height;
printf("Cylinder Calculator\n\n");
printf("Enter radius of cylinder : ");
scanf("%f", &radius);
printf("Enter height of cylinder : ");
scanf("%f", &height);
printf("\nCurved surface area of a cylinder = %.3f\n", curved_surface_area(radius, height));
printf("Total surface area of a cylinder = %.3f\n", total_surface_area(radius, height));
printf("Volume of cylinder = %.3f", volume_cyl(radius, height));
return 0;
}
Output :