HW5.23

时间:2023-03-08 23:57:48
HW5.23

HW5.23

 public class Solution
 {
     public static void main(String[] args)
     {
         int count = 0;

         for(int i = 0; i < 100; i++)
         {
             System.out.print(getRandomChar('A', 'Z') + " ");
             count++;
             if(count == 10)
             {
                 count = 0;
                 System.out.println();
             }
         }

         count = 0;

         for(int i = 0; i < 100; i++)
         {
             System.out.print(getRandomChar('0', '9') + " ");
             count++;
             if(count == 10)
             {
                 count = 0;
                 System.out.println();
             }
         }
     }

     public static char getRandomChar(char c1, char c2)
     { return (char)(c1 + Math.random() * (c2 - c1 + 1)); }
 }