输入两个正整数m和n,求其最大公约数和最小公倍数
输入
34 8
输出
2 136
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int m = in.nextInt();
System.out.println(gcd(m, n) + " " + m * n / gcd(m, n));
}
static int gcd(int a, int b) {
while(b != 0) {
int t = b;
b = a % b;
a = t;
}
return a;
}
}