用嵌套把这个弄出来
*
* *
* *
* *
*********
------解决方案--------------------
这样:
public class test{
int len;
int halfLen;
void f(int len){
this.len = len;
halfLen = len/2+1;
g(halfLen-1);
}
void g(int row){
if(row> 0)
g(row-1);
for(int i=1;i <=len;i++)
System.out.print(i==halfLen+row||i==halfLen-row||row==halfLen-1? "* ": " ");
System.out.println();
}
public static void main(String args[]){
new test().f(31);
}
}