#include<stdio.h> //#include<math.h> //#include<string.h> int main() { int a,b,c,m,temp; scanf("%d %d",&a,&b); if(a<b) { temp=a; a=b; b=temp; } m=a*b; c=a%b; while(c!=0) { a=b; b=c; c=a%b; } printf("%d %d\n",m/b,b); return 0; } |
Double click to view unformatted code.