Risonna

lab1_n4

Oct 30th, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include <math.h>
  2. #include <conio.h>
  3. #include <iostream>
  4. using namespace std;
  5. #define M_PI acos(-1.0)
  6. int main()
  7. {
  8. double s, R, r, l, h, v;
  9. cout << "r="; cin >> r;
  10. cout << "R="; cin >> R;
  11. cout << "l="; cin >>l;
  12. cout << "h="; cin >> h;
  13. s = M_PI*(R+r)*l+M_PI*pow(R,2)+M_PI*pow(r,2);
  14. cout <<"s="<<s<<"\n";
  15. v = (1. / 3) * (pow(R, 2) + pow(r, 2) + R * r) * h * M_PI;
  16. cout <<"v=" << v << "\n";
  17.  
  18. return 0;
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment