Advertisement
CoineTre

JF-ExcMethods07.NxN Matrix

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