Answer to Question #225894 in C++ for Ulando

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


1
Expert's answer
2021-08-18T06:51:54-0400
#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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS