Skip to content

Instantly share code, notes, and snippets.

@nalidzhik
Created June 1, 2021 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nalidzhik/40ecaccfc5a026e8934997efa247d6bd to your computer and use it in GitHub Desktop.
Save nalidzhik/40ecaccfc5a026e8934997efa247d6bd to your computer and use it in GitHub Desktop.
Solution of the matrix
import java.util.Scanner;
public class Problem9 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
if (n > 0 && n < 21) {
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n + i + 1; j++) {
System.out.print(j + " ");
}
System.out.println();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment