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