-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMAtrix1.java
More file actions
31 lines (25 loc) · 843 Bytes
/
MAtrix1.java
File metadata and controls
31 lines (25 loc) · 843 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
import java.util.Scanner;
public class MAtrix1 {
public static void main(String[] args) {
int i, j;
Scanner a = new Scanner(System.in);
System.out.println("enter the number of rows");
int rows = a.nextInt();
System.out.println("enter the number columns");
int cols = a.nextInt();
int number[][] = new int[rows][cols];
System.out.println("enter the input");
for (i = 0; i < rows; i++) {
for (j = 0; j < cols; j++) {
number[i][j] = a.nextInt();
}
System.out.println("MATRIX");
for (i = 0; i < rows; i++) {
for (j = 0; j < cols; j++) {
System.out.println(number[i][j] + " ");
}
System.out.println();
}
}
}
}