For循环打印三角形 and debug

 1 package com.pingfan.struct;
 2 
 3 public class TestDemo {
 4     public static void main(String[] args) {
 5         //打印三角形5行
 6         for (int i = 1; i <= 5; i++) {
 7             for (int j = 5; j >= i; j--) {
 8                 System.out.print(" ");
 9             }
10             for (int j =1;j <= i;j++){
11                 System.out.print("*");
12             }
13             for (int j = 1;j < i;j++){
14                 System.out.print("*");
15             }
16             System.out.println();
17         }
18     }
19 }

 

posted @ 2021-03-23 16:46  HeartlessHero  阅读(51)  评论(0)    收藏  举报