Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <math.h>
- #include <conio.h>
- #include <iostream>
- using namespace std;
- #define M_PI acos(-1.0)
- int main()
- {
- double s, R, r, l, h, v;
- cout << "r="; cin >> r;
- cout << "R="; cin >> R;
- cout << "l="; cin >>l;
- cout << "h="; cin >> h;
- s = M_PI*(R+r)*l+M_PI*pow(R,2)+M_PI*pow(r,2);
- cout <<"s="<<s<<"\n";
- v = (1. / 3) * (pow(R, 2) + pow(r, 2) + R * r) * h * M_PI;
- cout <<"v=" << v << "\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment