RGAlex

O7. NxN Matrix

Feb 8th, 2021
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.53 KB | None | 0 0
  1. package ExerciseMethoods;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class O7NxNMatrix {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.         int number = Integer.parseInt(scanner.nextLine());
  9.         nxnMatrix(number);
  10.     }
  11.  
  12.     public static void nxnMatrix(int number) {
  13.         for (int i = 0; i < number; i++) {
  14.             for (int j = 0; j < number; j++) {
  15.                 System.out.print(number + " ");
  16.             }
  17.             System.out.println(" ");
  18.         }
  19.     }
  20. }
  21.  
Advertisement
Add Comment
Please, Sign In to add comment