rengetsu

ProcedurProgramavimas_1.10

Feb 20th, 2018
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4. int main()
  5. {
  6.     const double PI = 3.14159265359;
  7.     long double p, h, r, z;
  8.     cin>>p;
  9.     cin>>h;
  10.     cin>>r;
  11.     if(p==1)
  12.     {
  13.     z=(PI*(r*r))*h;
  14.     cout<<fixed<<setprecision(2)<<z<<endl;
  15.     }
  16.     if(p==2)
  17.     {
  18.     z=((PI/3)*(r*r))*h;;
  19.     cout<<fixed<<setprecision(2)<<z<<endl;  
  20.     }
  21.     return 0;
  22. }
Add Comment
Please, Sign In to add comment