执行时只能获取m与n 而不能输出i
import java.util.Scanner;public class ScannerTest {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
//求最小公倍数
int n = scan.nextInt();
int m = scan.nextInt();
int min = (n < m) ? n : m;
for(int i = min; i >= 1; i--) {
if (n / i == 0 && m / i == 0) {
System.out.println(i);
break;
}
}
}
}
[此贴子已经被作者于2020-11-30 23:33编辑过]