Question #225894

Write a program to compute the volume of a cylinder. Your program reads the radius and length and computes using the formula:

Area =radius*radius*pi

Volume= area *length


Expert's answer

#include <iostream>
#include <cmath>


using namespace std;


int main()
{
    float r, h;
    float area, volume ;
    
    // Enter the value of radius
    cout<< "Enter the radius :" ;
    cin >> r ;
    
    // Enter the value of height
    cout<< "Enter the height :" ;
    cin >> h ;
    
    // calculating area
    area = M_PI * r * r ;
    
    // calculating volume of cylinder
    volume = area * h ;
    cout<<" Volume of cylinder is "<< volume << endl;


}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS