问题遇到的现象和发生背景 大一新生java运行完假盘录入后无反应
用代码块功能插入代码,请勿粘贴截图 Scanner sc = new Scanner(System.in);
System.out.println("请录入第一个数字");
int a = sc.nextInt();
System.out.println("请输入第二个数字");
int b = sc.nextInt();
int c = 0;
if (a >= b) {
for (int i = b; b <= a; i++) {
if (i % 3 == 0 && i % 5 == 0) {
c++;
}
}
} else {
for (int i = a; a < b; i++) {
if (i % 3 == 0 && i % 5 == 0) {
c++;
}
}
}
System.out.println(c);