#include<stdio.h> int main() { int m,n,a,b,t; scanf("%d %d",&m,&n); if(m < n) { t = m; m = n; n = t; } a = m; b = n; while(n) { t = m%n; m = n; n = t; } printf("%d %d",a*b/m,m); }
Double click to view unformatted code.