-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2D_Arrays_1.java
More file actions
34 lines (27 loc) · 1011 Bytes
/
2D_Arrays_1.java
File metadata and controls
34 lines (27 loc) · 1011 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
import java.util.Scanner;
public class 2D_Arrays_1 {
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();
}
}
int t_Rows= n-1;
int t_Columns= m-1;
System.out.println("Now We will print the values :-");
System.out.println("-------------------------------");
for(int i=t_Rows;i>=0;i--){
for(int j=t_Columns;j>=0;j--){
System.out.println("The value at:- [" + i + "][" +j+"]");
System.out.println(arr[i][j]);
}
}
}
}