您好我有一个问题,我必须打印出可被 17 整除的数字,但我想打印出 5 个数字,然后跳到下一行。这是我拥有的代码,不知道为什么它不起作用....
public class seventeen {
public static void main(String[] args) {
int num = 17;
System.out.print("The Numbers Divisible By 17 are: ");
int enter = 0;
for (int x = 1; x <= 10000; x++) {
if (x % num == 0) {
System.out.print(x + " ");
}
enter++;
if (enter == 5) {
enter = 0;
System.out.println();
}
}
}
}