Advertisement
spacerose

3 practice

Mar 8th, 2020
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4. int main()
  5. {
  6.     float a, b, x, y;
  7.     cin >> a >> b;
  8.     if (a < 0) a = a * (-1.0);
  9.     if (b < 0) b = b * (-1.0);
  10.     x = (a + b) / 2;
  11.     y = sqrt(a * b);
  12.     x = round(x * 1000.0) / 1000.0;
  13.     y = round(y * 1000.0) / 1000.0;
  14.     cout << x << " " << y;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement