Volume of cylinder in Cpp language


C program for volume of Cylinder

          Hello friends, in this blog we see the cpp 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. By using the following program, we find the area of the cylinder.

C language code for Volume of cylinder:
#include<iostream.h>
#include<conio.h>

void main()
{
    float vol,pie=3.14;

    float r,h;

    clrscr();

    cout<<"ENTER THE VALUE OF RADIUS:";

    cin>>r;

    cout>>"ENTER THE VALUE OF HEIGHT:";

    cin>>h;

    vol = pie * r * r * h;

    cin>>"VOLUME OF CYLINDER IS : "<<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 in Cpp language Volume of cylinder in Cpp language Reviewed by Amit Waghmare on November 02, 2019 Rating: 5

No comments: