/*
题目:打印出如下图案(菱形)
*
***
*****
*******
*****
***
*
*/
//通过建立平面直角坐标系来做这道题
public class Example19{
public static void main(String args[]){
for(int i=1;i<=7;i++){
for(int j=1;j<=7;j++){
if((i+j<5)||(i+j>11)||(i-j<-3)||(i-j>3)){
System.out.print(" ");
if(j==7){
System.out.println();
}
}
else{
System.out.print("*");
if(j==7){
System.out.println();
}
}
}
}
}
}
程序19
最新推荐文章于 2022-07-20 15:22:46 发布