题解 | #求最小公倍数#
求最小公倍数
http://www.nowcoder.com/practice/22948c2cad484e0291350abad86136c3
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
//求最小公倍数
Scanner scanner = new Scanner(System.in);
int a = scanner.nextInt();
int b = scanner.nextInt();
//ax=by
for (int y = 1; y <= a; y++) {
double x = b * y * 1.0 / a;
while (String.valueOf(x).endsWith(".0")) {
System.out.println(b * y);
return;
}
}
}
}