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