-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmultiDIM-ARRAY.java
More file actions
35 lines (30 loc) · 886 Bytes
/
multiDIM-ARRAY.java
File metadata and controls
35 lines (30 loc) · 886 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 com.company;
import java.util.Scanner;
public class multiarray
{
public static void main(String[] args)
{
int row , column , i , j ;
Scanner sc = new Scanner(System.in);
System.out.println("Enter no of Rows");
row = sc.nextInt();
System.out.println("Enter no of Columns");
column = sc.nextInt();
int array[][] = new int[row][column];
System.out.println("Enter Values");
for (i = 0 ; i < row ; i++) // row = 2 column = 3
{
for (j = 0; j < column; j++)
{
array[i][j] = sc.nextInt(); // [0,0] [0,1] [0,2] and [1,0] [1,1] ,[1,2]
}
}
for (i = 0 ; i < row ; i++) // row = 2 column = 3
{
for (j = 0; j < column; j++) {
System.out.print(array[i][j] + " ");
}
System.out.println();
}
}
}