8. C Program to find Volume of a Cylinder.
How does this program work?
- In this programme you will learn about how to calculate Volume of a Cylinder.
- This programme requires the user input to enter the Radius and Height of a Cylinder.
- This programme perform mathematical calculation and display the result using C language.
Here is the code
#include <stdio.h>
int main(void)
{
int r,h; //Initialise the variables
float pi=3.14,volume;
printf("Enter the Radius of a Cylinder:\n");
scanf("%d",&r); //To store the enter value
printf("Enter the Height of a Cylinder:\n");
scanf("%d",&h);
volume=pi*(r*r)*h; //Formula for volume of a Cylinder
printf("Volume of a Cylinder is: %.2f\n",volume);
return 0;
}