代码如下:
public class test09 {
public static void main(String[] args) {
//用while或for循环输出1-1000之间能被5整除的数,并且每行输出三个
for (int i = 1; i <= 1000; i++) {
if (i%5==0){
System.out.print(i+"\t");
}
//5 10 15 三个数为一组,第三个数不论为15 30 45 ...均能被15整除
//固可用为判定条件
if (i%15==0){
System.out.println();
}
}
}
}
运行部分结果: