HW4.18

HW4.18

 public class Solution
 {
     public static void main(String[] args)
     {
         System.out.println("Graph 1");
         for(int i = 1; i <= 6; i++)
         {
             for(int j = 1; j <= i; j++)
                 System.out.print(j + " ");
             System.out.println();
         }

         System.out.println();

         System.out.println("Graph 2");
         for(int i = 1; i <= 6; i++)
         {
             for(int j = 1; j <= 6 - i + 1; j++)
                 System.out.print(j + " ");
             System.out.println();
         }

         System.out.println();

         System.out.println("Graph 3");
         for(int i = 1; i <= 6; i++)
         {
             for(int j = 1; j <= 6 - i; j++)
                 System.out.print("  ");
             for(int j = i; j >= 1; j--)
                 System.out.print(j + " ");
             System.out.println();
         }

         System.out.println();

         System.out.println("Graph 4");
         for(int i = 1; i <= 6; i++)
         {
             for(int j = 1; j <= i - 1; j++)
                 System.out.print("  ");
             for(int j = 1; j <= 6 - i + 1; j++)
                 System.out.print(j + " ");
             System.out.println();
         }
     }
 }
上一篇:Java 学习笔记 ------第三章 基础语法


下一篇:C# 传统四舍五入保留两位小数(网上流传好多错误的版本)