example_1(for语句)

九九乘法表
public class jiujiu {
    public static void main(String[] args){
        for(int i=1;i<=9;i++){
            for(int j=1;j<=i;j++){
                System.out.print(j+"*"+i+"="+(i*j<10?(" "+i*j):i*j)+" ");
                if(i==j){System.out.print('\n');}
            }
        }
    }
}

 

 
posted @ 2022-03-21 00:06  Theext  阅读(39)  评论(0)    收藏  举报