Write a prgram to compute the volume of a cylinder using the formula of v=3.14*r*r*h and the volume of a sphere as vs=4/3*3.14*r^3
Answers
Answered by
1
Answer:
Note: I am using C++ programming language.
Code
#include<iostream>
using namespace std;
int main() {
float r1, r2, vol1, vol2, h ;
cout<<"Enter radius of cylinder : ";
cin>>r1;
vol1 = 3.14*r1*r1*h ;
cout<<"Enter radius of Sphere: ";
cin>>r2 ;
vol2 = (4/3)*3.14*r2*r2*r2 ;
cout<<"\nVolume of Cylinder is " <<vol1 <<" ." <<endl;
cout<<"\nVolume of Sphere is " <<vol2 <<" ." <<endl;
return 0;
}
Please follow me and mark this ans as Branliest answer.Thank you!
Similar questions