[code=Java]import java.io.InputStreamReader;


public class Work ...{
public static void main(String[] args) throws IOException ...{
int len; // 菱长
String outstr=new String(); // 输出
int i,j,x,y;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("请输入一个菱长:");
String str = br.readLine();
len=Integer.parseInt(str); 
for(i=0;i<=len*2;i++)...{ 
for(j=0;j<=len*2;j++)...{
x=len-i;
x=x<0?-1*x:x;
y=len+(len-x);
outstr+=(j==x||j==y?"*":" ");
}
outstr+=" ";
}
System.out.println(outstr);
}
}
[/code]发表于 @ 2007年11月24日 16:04:00 | 评论( loading... ) | 举报| 收藏