View Code of Problem 59

#include <bits/stdc++.h>
using namespace std;

int main() {
    int x, y, i;
    cin >> x >> y;
    if(x > y)
        swap(x, y);
    for(i = y; (i%x) || (i%y); i++);
    cout << i << ' ';
    for(i = x; (x%i) || (y%i); i--);
    cout << i;
    return 0;
}

Double click to view unformatted code.


Back to problem 59