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 j = 1; j<=i; j++) {System.out.print("*");}for (int j = 1; j<i; j++) {System.out.print("*");}System.out.println();}}
}
https://www.bilibili.com/video/BV12J41137hu?p=44&spm_id_from=pageDriver