java 金字塔

 

 1 public class a {
 2 public static void main(String[] args){
 3 int i=1,j=1;
 4 for (i=1;i<=9;i++)
 5 {
 6 for (j=1;j<=8+i;j++)
 7 
 8 {
 9 if(i+j<=9)
10 {
11 System.out.print(" ");
12 }else {
13 System.out.print("*");
14 }
15 
16 }
17 System.out.println();
18 }
19 }
20 
21 }

 

 

 

posted @ 2021-12-07 21:00  芸小宇  阅读(102)  评论(0)    收藏  举报