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