#include<bits/stdc++.h> using namespace std; int main() { int m, n; cin >> m >> n; int a = m * n; int t; while (n%m) { t = n; n = n % m; m = t; } cout << a / m << " " << m; }
Double click to view unformatted code.