打印漏图案

 


public class H {

public static void main(String[] args) {

for (int i = 2; i >=-2; i--) {//打印行数
for (int j = 0; j <= 2-Math.abs(i); j++) {//打印该行的前边
System.out.print(" ");
}
for (int j = 0; j < Math.abs(i)*2+1; j++) {//打印改行的后边
System.out.print("*");
}
System.out.println();
}
}
}

 

 

*****
  ***
    *
  ***
*****

posted on 2016-03-08 21:36  卅年  阅读(155)  评论(0编辑  收藏  举报

导航