# Untitled

a guest
Oct 18th, 2021
105
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. //2.1
2. /*#include <iostream>
3. #define _USE_MATH_DEFINES
4. #include <math.h>
5. using namespace std;
6. double V,R,r,h,S,l;
7. int main()
8. {
9. cout<<"Enter nums"<<endl;
10. cin>>r>>R>>h;
11. if (h >0 and R>0 and r>0){
12. l=sqrt((h*h+pow((R-r),2)));
13. V = (M_PI * h * (pow(R, 2) + R * r + pow(r, 2)) / 3);
14. S = M_PI * (pow(R, 2) + (R + r) * l + pow(r, 2));
15. cout << S << " " << V;
16. }
17. else{
18. cout<<"Введите числа больше нуля";
19. }
20. return 0;
21. }*/
22. //2.2
23. /*#include <iostream>
24. #define _USE_MATH_DEFINES
25. #include <math.h>
26. using namespace std;
27. float w,a,x;
28.
29. int main()
30. {
31. cout<<"Enter nums"<<endl;
32. cin >> x>>a;
33. if (x==0){
34. cout<<"Error"<<endl;
35. }
36. else {
37. if (abs(x) < 1) {
38. w = a * log(abs(x));
39. cout << abs(w);
40. }
41. else {
42. if (a - pow(x, 2) < 0) {
43. cout << "error\n";
44. }
45. else {
46. w = sqrt(a - pow(x, 2));
47. cout << abs(w);
48. }
49. }
50. }
51. return 0;
52. }*/
RAW Paste Data