C program for volume
of Cylinder
Hello
friends, in this blog we see the c program for finding the Volume of cylinder.
To find the volume of a cylinder we must know the formula for calculating the
area of cylinder i.e. vol = pie * r * r * h.
In
this formula the value of is in float i.e. 3.14, so we are using float
datatype and for store fractional value we use %f. By using the following program,
we find the area of the cylinder.
C language code for Volume of cylinder:
#include<stdio.h>
#include<conio.h>
void main()
{
float vol,pie=3.14;
float r,h;
clrscr();
printf("ENTER THE VALUE OF RADIUS:");
scanf("%f",&r);
printf("ENTER THE VALUE OF HEIGHT:");
scanf("%f",&h);
vol = pie *
r * r * h;
printf("VOLUME OF CYLINDER IS : %f ",vol);
getch();
}
Output:
ENTER THE VALUE OF RADIUS: 7
ENTER THE VALUE OF HEIGHT :3
VOLUME OF CYLINDER IS: 461.58
ENTER THE VALUE OF RADIUS: 4.6
ENTER THE VALUE OF HEIGHT: 6.8
VOLUME OF CYLINDER IS: 451.80832
Volume of cylinder C language
Reviewed by Amit Waghmare
on
August 14, 2019
Rating:
No comments: