12345678910111213141516171819202122232425 |
- #include <stdio.h>
- int gcd(int a, int b) {
- if (b == 0) {
- return a;
- }
- return gcd(b, a % b);
- }
- int lcm(int a, int b) {
- return a / gcd(a, b) * b;
- }
- int main() {
- int a, b;
- scanf("%d %d", &a, &b);
-
- int greatest_common_divisor = gcd(a, b);
- int least_common_multiple = lcm(a, b);
- printf("%d %d\n", greatest_common_divisor, least_common_multiple);
- return 0;
- }
|