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