Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- int main()
- {
- float x, y, s;
- cout << "x="; cin >> x;
- cout << "y="; cin >> y;
- if (x != y)
- {
- if (y > x)
- {
- s = y;
- y = y * x * 2;
- x = (x + s) * 0.5;
- }
- else
- {
- s = x;
- x = y * x * 2;
- y = (s + y) * 0.5;
- }
- }
- else
- {
- cout << "x=y, действия не имеют смысла\n";
- }
- cout << "x=" << x << "\n";
- cout << "y=" << y << "\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement