mirror of
https://github.com/renbaoshuo/202401-programming-assignments.git
synced 2024-11-27 14:36:19 +00:00
21 lines
274 B
C
21 lines
274 B
C
|
#include <stdio.h>
|
||
|
|
||
|
int gcd(int x, int y) {
|
||
|
if (x == 0) return y;
|
||
|
return gcd(y % x, x);
|
||
|
}
|
||
|
|
||
|
int lcm(int x, int y) {
|
||
|
return x / gcd(x, y) * y;
|
||
|
}
|
||
|
|
||
|
int main() {
|
||
|
int m, n;
|
||
|
|
||
|
scanf("%d%d", &m, &n);
|
||
|
|
||
|
printf("%d %d\n", gcd(m, n), lcm(m, n));
|
||
|
|
||
|
return 0;
|
||
|
}
|