1.这样的如下图:      
    *
  * * *
* * * * *
  * * * 
    *2.这样的如下图:
* * * * *
  * * * *
    * * *
      * *
        *谢谢了..!

解决方案 »

  1.   


    1.这样的如下图:      
        *
      * * *
    * * * * *
      * * * 
        *public void printAngle(int n)         //n=3
    {
    for(int i=1;i<n+1;i++)
    {
    for(int j=i;j<n+1;j++)
    System.out.print(" ");
    for(int k=1;k<i+1;k++)
    System.out.println("*");//System.out.print(k);
    for(int m=i-1;m>0;m--)
    System.out.println("*");//System.out.print(m);
    System.out.println();
    }
    for(int i=n-1;i>0;i--)
    {
    for(int m=1;m<n-i+2;m++)
    System.out.print(" ");
    for(int k=1;k<i+1;k++)
    System.out.println("*");//System.out.print(k);
    for(int j=i-1;j>0;j--)
    System.out.println("*");//System.out.print(j);
    System.out.println();
    }
    }2.这样的如下图:
    * * * * *
      * * * *
        * * *
          * *
            *
    public void printRecAngel(int n) //n=5
    {
    for(int i=1;i<n+1;i++)
    {
    for(int j=1;j<i;j++)
    System.out.print(" ");
    for(int j=i;j<n+1;j++)
    System.out.print("*");//System.out.print(j);
    System.out.println();
    }
    }
      

  2.   

    class Print{
    public static void main(String arg[]){
    printRecAngel();
    printRecAngel();
    }
    public void printRecAngel() 
    {

            System.out.println("     *" );
            System.out.println("   * * *");
            System.out.println(" * * * * *");
            System.out.println("   * * *"); 
            System.out.println("     *");
    }
    public void printRecAngel(){
            System.out.println("* * * * *");
            System.out.println("  * * * *");
            System.out.println("    * * *");
            System.out.println("      * *"); 
            System.out.println("        *");}
    }
      

  3.   

    1.这样的如下图:      
        *
      * * *
    * * * * *
      * * * 
        *
    public class A 
    {
    public static void main(String[] args) 
    {
    for(int i=1;i<=3;i++)
    {
       for(int j=1;j<=6-2*i;j++)
        
       System.out.print(" ");     for(int j=1;j<=2*i-1;j++)
         
       System.out.print("* ");
             System.out.println();                         //打印上三角

    }

    for(int i=1;i<=2;i++)
    {
         for(int j=1;j<=2*i;j++)
                  
       System.out.print(" ");      for(int j=1;j<=5-2*i;j++)

           System.out.print("* ");             System.out.println();  
    }                                                //打印下三角


    }
    }* * * * *
      * * * *
        * * *
          * *
            *
    public class C{
    public static void main(String[] args) 
    {
    for(int i=1;i<=5;i++)             //打印行数
    {
       for(int j=1;j<=2*i-2;j++)     
      
       System.out.print(" ");         //打印每行空格

        for(int j=1;j<=6-i;j++)
      
        System.out.print("* ");        //打印每行星号           System.out.println();
    }


    }
    }
      

  4.   

    第二个得:
    public class Csdn {
        private static int I=0;//控制“*'的个数       public static void main(String[] args) {
        
            display(4);
        }
        
        public static void display(int n){
         //采用递归
         if(n>0){    
         print(I,n);
         I++;
         display(n-1);   
         }   
        } 
        
        private static void print(int kong,int xing){
         for(;kong>0;kong--)//打印空格
         System.out.print(" ");
         for(;xing >0;xing--)//打印“*”
         System.out.print("*");
         System.out.println();   
        }    
    }
      

  5.   

    1.
    /**
     * 打印菱形
     * @author AZERO
     */
    public class PrintDiamond { /**
     * 打印菱形
     * @author 汤波
     * @param n
     */
    public static void print(int n){
    if(n > 0 && n % 2 != 0){
    /*打印上半部*/
    for(int i = 0;i < n / 2 + 1; i++){
    for(int j = 0; j < n; j++){
    if(j >= (n - 1) / 2 - i  && j <= (n - 1) / 2 + i){
    System.out.print("*");
    }else{
    System.out.print(" ");
    }
    }
    System.out.println();
    }

    /*打印下半部*/
    for(int i = 1;i <= (n - 1) / 2; i++){
    for(int j = 0;j < n; j++){
    if(j >= (n - 1) / 2 - n / 2 + i && j <= (n - 1) / 2 + n / 2 - i){
    System.out.print("*");
    }else{
    System.out.print(" ");
    }
    }
    System.out.println();
    }
    }else{
    System.out.println("请输入奇数!");
    }
    }

    /**
     * @param args
     */
    public static void main(String[] args) {
    PrintDiamond.print(25);
    }}2.太简单不说了
      

  6.   

    JAVA 爱好者加群  38236097
    JAVA 爱好者加群  38236097