-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMatrix.java
More file actions
36 lines (33 loc) · 910 Bytes
/
Matrix.java
File metadata and controls
36 lines (33 loc) · 910 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
36
// Program: Input and Display Elements of a 2x3 Matrix
// Topic: 2D Arrays
// Description: Reads elements into a 2x3 integer matrix from user input and then displays them.
// Demonstrates basic input, storage, and traversal of two-dimensional arrays using nested loops.
package Array2D;
import java.util.*;
/**
*
* @author Samim
*/
public class Matrix
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int ar[][]=new int[2][3];
System.out.println("Enter The Elements :");
for(int i=0;i<2;i++)
{
for(int j=0;j<3;j++)
{
ar[i][j]=sc.nextInt();
}
}
for(int i=0;i<2;i++)
{
for(int j=0;j<3;j++)
{
ar[i][j]=sc.nextInt();
}
}
}
}