用while或for循环输出1-1000之间能被5整除的数,并且每行输出三个

//用while或for循环输出1-1000之间能被5整除的数,并且每行输出三个
public class A5 {
    public static void main(String[] args) {
        for (int i = 1; i <= 1000; i++) {
            if (i%5==0){
                System.out.print(i+"\t");//print不换行  println换行
            }
            if(i%(5*3)==0){
                System.out.println();
            }

        }

    }
}

2021-03-10 00:21:52

posted @ 2021-03-10 00:22  域明夜  阅读(363)  评论(0)    收藏  举报