-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsheet11.java
42 lines (37 loc) · 1.35 KB
/
sheet11.java
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
37
38
39
40
41
42
import java.util.Scanner;
public class sheet11{
public static void main(String ar[]){
Scanner scan=new Scanner(System.in);
System.out.println("--------- Matrix -----------");
System.out.print("Enter Length of Row : ");
int row = scan.nextInt();
System.out.print("Enter Length of Column : ");
int column = scan.nextInt();
int Matrix[][]=new int[row][column];
System.out.println("Enter Matrix Values :");
for(int i=0;i<row;i++){
for(int j=0;j<column;j++){
Matrix[i][j]=scan.nextInt();
}
}
System.out.println("--------- Matrix 2 -----------");
System.out.print("Enter Length of Row : ");
int row1 = scan.nextInt();
System.out.print("Enter Length of Column : ");
int column1 = scan.nextInt();
int Matrix1[][]=new int[row1][column1];
System.out.println("Enter Matrix Values :");
for(int i=0;i<row1;i++){
for(int j=0;j<column1;j++){
Matrix1[i][j]=scan.nextInt();
}
}
for(int i=0;i<row;i++){
for(int j=0;j<column;j++){
System.out.print(" "+Matrix[i][j]+Matrix1[i][j]);
}
System.out.println("");
}
scan.close();
}
}