HW5.17

时间:2023-03-08 17:24:43
HW5.17

HW5.17

 import java.util.Scanner;

 public class Solution
 {
     public static void main(String[] args)
     {
         Scanner input = new Scanner(System.in);
         System.out.print("Enter a number: ");
         int number = input.nextInt();

         input.close();

         printMatrix(number);
     }

     public static void printMatrix(int n)
     {
         for(int i = 0; i < n; i++)
         {
             for(int j = 0; j < n; j++)
                 System.out.print((int)(Math.random() * 2) + " ");
             System.out.println();
         }
     }
 }