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