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