import java.util.Scanner; /* * Prints a matrix of numbers of the form: 1 1 1 ... 1 2 2 2 ... 2 ... N N N ... N */ public class PrintNumMatrix { public static void main(String[] args) { int i, j, num; Scanner sc = new Scanner(System.in); System.out.print("Enter a number: "); num = sc.nextInt(); // Print all numbers between 1 and num for (i = 1; i <= num; i++) { for (j = 1; j <= num; j++) { System.out.print(i+" "); } System.out.println(); } } }