package com.lyc.struct;

public class TestDemo01 {
public static void main(String[] args) {
//打印5行三角形

for (int i = 1; i <= 5; i++) {
for (int j = 5; j >= i; j--){
System.out.print(" ");
}
for (int k = 1; k <= i; k++) {
System.out.print("*");
}
for (int t = 1; t < i; t++){
System.out.print("*");
}
System.out.println();
}

}
}
/*
运行结果:

    *
   ***
  *****
 *******
*********

 

 

*/
posted on 2021-01-07 17:00  liuyunche  阅读(303)  评论(0)    收藏  举报