打印一个三角形
作者:互联网
package com.hai.week2; public class Demo01 { 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(); } } }
标签:hai,一个,打印,int,三角形,main,public 来源: https://www.cnblogs.com/lf-ancer/p/16340294.html