#include <stdio.h> using namespace std; int main(){ int a,b; scanf("%d%d", &a,&b); int c = a; int d = b; while( b>0 ){ int t = a%b; a = b; b = t; } printf("%d %d", c*d/a, a ); return 0; }
Double click to view unformatted code.