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