import java.util.Scanner;
class XingXing {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("请输入一个正整数,强力建议3~20");
int z = sc.nextInt();
if (z > 0) {
for (int h = 1;h <= z ;h++ ) {
xing(h,z);
}
}else
System.out.println("你逗老子");
}
public static void xing(int h,int z) {
int b = h;
while ( b > 1 ) {
System.out.print(" ");
b--;
}
for (int a = z + 1 - h;a > 0 ;a-- ) {
System.out.print("*" + " ");
}
System.out.println();
}
}
倒三角 |