-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2D_Array.java
More file actions
32 lines (25 loc) · 940 Bytes
/
2D_Array.java
File metadata and controls
32 lines (25 loc) · 940 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
import java.util.Scanner;
public class 2D_Array {
public static void main(String[] args){
Scanner sc= new Scanner(System.in);
System.out.println("Enter the number of rows required :-");
int n= sc.nextInt();
System.out.println("Enter the number of columns required :-");
int m= sc.nextInt();
int[][] arr= new int[n][m];
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
System.out.println("Enter the value for :- [" + i + "][" +j+"]");
arr[i][j]= sc.nextInt();
}
}
System.out.println("Now We will print the values :-");
System.out.println("-------------------------------");
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
System.out.println("The value at:- [" + i + "][" +j+"]");
System.out.println(arr[i][j]);
}
}
}
}