作者: 付龙 时间: 2013-7-18 14:34
public class Fun {
public int len=12;//菱形边长
public void dosth(){
for(int i=0;i<(2*len-1)*len;i++){
if(i/(2*len-1)+i%(2*len-1)==len||i/(2*len-1)+i%(2*len-1)==2*len-1||(i>=len&&i<=2*len-1)||(i>=(2*len-1)*(len-1)+1&&i<=(2*len-1)*len-len+1)){
System.out.print("*");
}else{
System.out.print(" ");
} if(i%(2*len-1)==0){
System.out.println();
}
}
}
public static void main(String[] args){
Fun f=new Fun();
f.dosth();
}
}