- Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy path2D-Array.java
More file actions
Latest commit
32 lines (26 loc) · 775 Bytes
/
Copy path2D-Array.java
File metadata and controls
32 lines (26 loc) · 775 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
importjava.util.Scanner;
publicclass ----name----{
publicstaticvoidmain (String[] args)
{
System.out.print("Enter 2D array size : ");
Scannersc=newScanner(System.in);
introws=sc.nextInt();
intcolumns=sc.nextInt();
System.out.println("Enter array elements : ");
inttwoD[][]=newint[rows][columns];
for(inti=0; i<rows;i++)
{
for(intj=0; j<columns;j++)
{
twoD[i][j]=sc.nextInt();
}
}
System.out.print("\nData you entered : \n");
for(int []x:twoD){
for(inty:x){
System.out.print(y+" ");
}
System.out.println();
}
}
}