-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExerciseThree.java
More file actions
35 lines (24 loc) · 821 Bytes
/
Copy pathExerciseThree.java
File metadata and controls
35 lines (24 loc) · 821 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package UnitFour;
import java.util.Scanner;
public class ExerciseThree {
public static void main(String[] args){
Scanner scanner =new Scanner(System.in);
System.out.println("Enter row: ");
int row = scanner.nextInt();
System.out.println("Enter colum: ");
int colum = scanner.nextInt();
int[][] matrix = new int[row][colum];
System.out.println("Enter number in the matrix: ");
for(int i = 0; i<row; i++) {
for(int j = 0; j< colum; j++){
matrix [i] [j] = scanner.nextInt();
}
}
System.out.println("The matrix is:");
for (int i = 0; i < row; i++) {
for (int j = 0; j < colum; j++) {
System.out.print(matrix[i][j] + " ");
}
}
}
}