import java.util.Scanner;
public class Star {
public static void main(String[] args) {
// 设置层数
System.out.println("请输入你要打印金字塔层数:");
Scanner scanner = new Scanner(System.in);
int totalLevel =scanner.nextInt();
// 打印空心金字塔
for (int i = 1; i <= totalLevel; i++) {
//输出空格 总层数 - 1 个空格
for (int k = 1; k <= totalLevel - i; k++) {
System.out.print(" ");
}
//输出 * 每层有 2*i-1个 * 号
for (int j = 1; j <= 2 * i - 1; j++) {
// 每一行的第一个位置和最后一个位置输出输出*,最后一行全部输出
if (j == 1 || j == 2 * i - 1 || i == totalLevel) {
System.out.print("*");
}else {
//输出空心
System.out.print(" ");
}
}
// 每完成一行的输出,进行换行
System.out.println();
}
}
}