打印三角形及Debug
流程控制练习:
1 package struct; 2 3 public class TestDemo { 4 public static void main(String[] args) { 5 //打印三角形 5行 6 for (int i = 0; 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 }