Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int main() {
- int a, b;
- std::cin >> a >> b;
- while (b != 0) {
- int r = a % b;
- a = b;
- b = r;
- std::cout << r << " ";
- }
- std::cout << std::endl;
- // for (int i = std::min(a, b); i >= 1; --i) {
- // if (a % i == 0 && b % i == 0) {
- // gcd = i;
- // break;
- // }
- // }
- std::cout << a;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement