三角形和菱形

        //三角形
        for (int i = 1; i < 6; i++)
        {
             for (int j = 1; j <=i; j++) 
            {
                
                System.out.print("△");
            }
            System.out.println();
        }
        System.out.println();
        
        //菱形
        for (int i = 1; i < 6; i++)
        {
             for (int j = 1; j<6-i; j++) 
            {
                
                System.out.print(" ");
                
            }
             for (int j = 0; j<2*i-1; j++) 
            {
                
                System.out.print("◇");
                
            }
            System.out.println();
        }
        for (int i = 1; i < 5; i++)
        {
             for (int j = 1; j<=i; j++) 
            {
                
                System.out.print(" ");
                
            }
             for (int j = 0; j<2*(5-i)-1; j++) 
            {
                
                System.out.print("◇");
                
            }
            System.out.println();
        }

posted @ 2016-05-08 15:18  凌零聆  阅读(473)  评论(0编辑  收藏  举报