Computer Science, asked by aryankhatri40, 6 months ago

1.Write a program in c++ to radius & height then find the volume of cylinder ?

(Hint : volume of cylinder = πr2h)​

Answers

Answered by avijitm88
2

Answer:

#include <iostream>

using namespace std;

int main() { int rad1,hgt;

float volcy;

cout << "\n\n Calculate the volume of a cylinder :\n";

cout << "-----------------------------------------\n";

cout<<" Input the radius of the cylinder : ";

cin>>rad1;

cout<<" Input the height of the cylinder : ";

cin>>hgt;

volcy=(3.14*rad1*rad1*hgt);

cout<<" The volume of a cylinder is : "<< volcy << endl; cout << endl;

return 0; }

Answered by ajeeprasad973
2

C++ Basic: Exercise-16 with Solution

Write a program in C++ to calculate the volume of a cylinder.

Sample Solution:

C++ Code :

#include <iostream>

using namespace std;

int main()

{

int rad1,hgt;

float volcy;

cout << "\n\n Calculate the volume of a cylinder :\n";

cout << "-----------------------------------------\n";

cout<<" Input the radius of the cylinder : ";

cin>>rad1;

cout<<" Input the height of the cylinder : ";

cin>>hgt;

volcy=(3.14*rad1*rad1*hgt);

cout<<" The volume of a cylinder is : "<< volcy << endl;

cout << endl;

return 0;

}

Copy

Sample Output:

Calculate the volume of a cylinder :

-----------------------------------------

Input the radius of the cylinder : 6

Input the height of the cylinder : 8

The volume of a cylinder is : 904.32

Flowchart:

Flowchart: Calculate the volume of a cylinder

Explanation:

i \: hope \: its \: help \: you

Similar questions