import java.util.Scanner;
public class LingXing {
public static void main(String[] args){
int a;
int b;
System.out.println("请输入:");
Scanner in = new Scanner(System.in);
b = in.nextInt();
a = (b+1)/2;
for(int i = 0;i<a;i++){
for(int k = a-1;k>i;k--){
System.out.println(" ");
}
for(int j = 0;j<2*i+1;j++){
System.out.println("*");
}
System.out.println();
}
for(int i =1;i<=a-1;i++){
for(int j = 1;j<=i;j++){
System.out.println(" ");
}
for(int k = 2*a-3;k>=2*i-1;k--){
System.out.println("*");
}
System.out.println();
}
}
}
转载于:https://www.cnblogs.com/sha-/p/10786520.html