danaildobrev

Matrix of numbers

Feb 15th, 2022
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.         Scanner sc = new Scanner(System.in);
  7.  
  8.         int n = sc.nextInt();
  9.         int lines, column;
  10.  
  11.         for ( column = 1; column <= n; column++){
  12.             System.out.print(column + " ");
  13.  
  14.             for (lines = column + 1; lines < column + n; lines++){
  15.                 System.out.print(lines + " ");
  16.             }
  17.             System.out.println();
  18.         }
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment