首页 > 代码库 > java打印图形

java打印图形

ublic class ph{
public static void main(String [] args){
         /* for(int i =0;i<7; i++){
                 for(int j =0;j<7; j++){
                   if(j<7-i){
                           System.out.print("*");
                                   }else {
                             System.out.print(" ");}
                        }
                    System.out.println("");
                 }
for(int i =0;i<7; i++){
                 for(int j =0;j<7; j++){
                   if(j<i){
                           System.out.print("*");
                                   }else {
                             System.out.print(" ");}
                        }
                    System.out.println("");


                 }*/
for(int i =1;i<=14; i++){
                 for(int j =1;j<=14; j++){
                  if(j<=7-i){
                          System.out.print(" ");
                                  }else if (j>=13-i&&i<=6){
                             System.out.print("*");
                        }
                        
                    }System.out.println("");}

for(int i = 0;i <4;i++){
        for(int j = i; j <4;j++){
       System.out.print(" ");
               }
        for(int k =0;k<2*i+1;k++){
     System.out.print("*");
            }
   System.out.println("");
   }
        }
}

java打印图形