要求用两个for打印出如下图形
      *
    ***
   *****
    ***
     *30分献上了

解决方案 »

  1.   

    public class  Test

    public static int Count=3;
    public static void main(String[] args) 

    for(int i=0;i<Test.Count*2-1;i++){
    int p=Math.abs(Test.Count-i-1);
    int q=Test.Count-Math.abs((Test.Count-i-1));
    for(int j=0;j<p;j++)
    System.out.print(" ");
    for(int j=0;j<2*q-1;j++)
    System.out.print("*");
    System.out.println();
    }
    }
    }
      

  2.   

    有兴趣的话,可以看看这个帖子http://topic.csdn.net/u/20080705/09/4d6c0fae-d8e8-466f-8c28-f6f17dc18b07.html
      

  3.   


    public class  Test { 
        public static int Count=3; 
        public static void main(String[] args) { 
        for(int i=0;i <Test.Count*2-1;i++){ 
            int p=Math.abs(Test.Count-i-1); 
            int q=Test.Count-Math.abs((Test.Count-i-1)); 
            for(int j=0;j <p;j++) 
                System.out.print(" "); 
            for(int j=0;j <2*q-1;j++) 
                System.out.print("*"); 
            System.out.println(); 
        } 
        } 
    }