java asterisk right triangle

前端 未结 5 1235
星月不相逢
星月不相逢 2020-12-11 11:56

I\'d like to try a right triangle asterisk. But I only got this output: (I can\'t place here the asterisk)

@ 
@@
@@@

what

5条回答
  •  被撕碎了的回忆
    2020-12-11 12:58

    for(int i = 0; i < 9; i++) {
        for(int j = 9; j > 0; j--)
            System.out.print(i < j ? " " : "*");
    
        System.out.println();
    }
    

提交回复
热议问题