Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int main()
- {
- int m, n, a = 0, b = 0;
- std::cin >> m >> n;
- do
- {
- if (m > n) { m -= n; a++; b = n; }
- if (m < n) { n -= m; a++; b = m; }
- if (m == n) { a++; b = m; break; }
- if (n == 1 && n < m) { a += m; b = n; break; }
- if (m == 1 && n > m) { a += n; b = m; break; }
- } while (m != 0 || n != 0);
- std::cout << a << ' ' << b << std::endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement