Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- using namespace std;
- int main()
- {
- const double PI = 3.14159265359;
- long double p, h, r, z;
- cin>>p;
- cin>>h;
- cin>>r;
- if(p==1)
- {
- z=(PI*(r*r))*h;
- cout<<fixed<<setprecision(2)<<z<<endl;
- }
- if(p==2)
- {
- z=((PI/3)*(r*r))*h;;
- cout<<fixed<<setprecision(2)<<z<<endl;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment