题:使用while循环完成输出所有三位数中能被8整除的数,每个数字之间以空格间隔开,每输出10个数字换行。 效果图:
public static void main(String[] args) {int i = 100;int j = 0;while (i<999){if (i % 8 == 0){System.out.print(i+" ");j++;}if (j == 10){j = 0;System.out.println();}i++;}}
运行结果
多谢大佬,已关注,有事私聊你
嗯,好的