Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. ვარიანტი 1
  2.  
  3. 2)
  4.  
  5. #include <iostream>
  6.  
  7. using namespace std;
  8.  
  9. int main() {
  10. double x;
  11. cin >> x;
  12.  
  13. if (x >= 1) {
  14. cout << x;
  15. } else if (x >= -1 && x < 1) {
  16. cout << -x;
  17. } else if (x < -1){
  18. cout << (2*x -1);
  19. }
  20.  
  21. return 0;
  22. }
  23.  
  24. 3)
  25.  
  26. #include <iostream>
  27.  
  28. using namespace std;
  29.  
  30. double max(int a, int b) {
  31. if (a > b) {
  32. return a;
  33. }
  34. return b;
  35. }
  36.  
  37. int main() {
  38. double a, b, c;
  39. cin >> a >> b >> c;
  40.  
  41. double m = max(a, b);
  42. m = max(m, c);
  43. cout << m;
  44. return 0;
  45.  
  46. }
  47.  
  48. 4)
  49.  
  50. #include <iostream>
  51.  
  52. using namespace std;
  53.  
  54. int main() {
  55. double x;
  56. cin >> x;
  57. double y = 5 * x * x + 4 * x - 7;
  58. cout << y;
  59. return 0;
  60.  
  61. }
  62.  
  63. 5)
  64.  
  65. #include <iostream>
  66.  
  67. using namespace std;
  68.  
  69. int main() {
  70. double a, b;
  71. cin >> a >> b;
  72. double area = a * b;
  73. cout << area;
  74. return 0;
  75.  
  76. }
  77.  
  78. ვარიანტი 2
  79.  
  80. 2)
  81. #include <iostream>
  82.  
  83. using namespace std;
  84.  
  85. int main() {
  86. double x;
  87. cin >> x;
  88.  
  89. if (x >= 0) {
  90. cout << x;
  91. } else if (x == 0) {
  92. cout << 0;
  93. } else if (x < 0){
  94. cout << -x;
  95. }
  96.  
  97. return 0;
  98. }
  99.  
  100. 5)
  101.  
  102. #include <iostream>
  103.  
  104. using namespace std;
  105.  
  106. int main() {
  107. double x;
  108. cin >> x;
  109. double y = 7 * x * x + 2 * x - 5;
  110. cout << y;
  111. return 0;
  112. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement