沙漏图形打印

public static Text{
public static void main(String[]args){
      for(int i=2;i>=-2;i=i-1){
            for(int k=0;k<=2-Math.abs(i);k++){
                    System.out.print(" ");
            }
            for(int j=0;j<Math.abs(i)*2+1;j++){
                    System.out.print("*");
            }
            System.out.println();
            }
      }
}

 

posted @ 2016-03-08 15:24  李泽阳  阅读(135)  评论(0编辑  收藏  举报