package know;
import java.util.Scanner;
public class T23 {
public static void main(String[] args) {
System.out.println("输入数字:");
Scanner s=new Scanner(System.in);
int n=s.nextInt();
s.close();
int len=2*n-1;
for(int i=1;i<=n;i++){
System.out.println(format(i, len));
}
}
private static String format(int i, int len){
int b=(len-(2*i-1))/2;
StringBuilder sb=new StringBuilder();
for(int j=0;j<b;j++){
sb.append(" ");
}
for(int j=0;(j<2*i-1);j++){
sb.append("*");
}
for(int j=0;j<b;j++){
sb.append(" ");
}
return sb.toString();
}
}
追问不对啊