MCPcopy Create free account
hub / github.com/Manvityagi/PW-Skills-Java-Course-Codes / main

Method main

Lecture 20 - 2D Arrays/src/Matrix.java:54–85  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

52 }
53
54 public static void main(String[] args) {
55 Scanner sc = new Scanner(System.in);
56 System.out.println("Enter number of rows and columns of matrix 1");
57 int r1 = sc.nextInt();
58 int c1 = sc.nextInt();
59 int[][] a = new int[r1][c1];
60 System.out.println("Enter matrix values");
61 for (int i = 0; i < r1; i++){
62 for(int j = 0; j < c1; j++){
63 a[i][j] = sc.nextInt();
64 }
65 }
66
67 System.out.println("Enter number of rows and columns of matrix 2");
68 int r2 = sc.nextInt();
69 int c2 = sc.nextInt();
70 int[][] b = new int[r2][c2];
71 System.out.println("Enter matrix values");
72 for (int i = 0; i < r2; i++){
73 for(int j = 0; j < c2; j++){
74 b[i][j] = sc.nextInt();
75 }
76 }
77
78 System.out.println("Matrix 1");
79 printMatrix(a);
80 System.out.println("Matrix 2");
81 printMatrix(b);
82
83// add(a, r1, c1, b, r2, c2);
84 multiply(a, r1, c1, b, r2, c2);
85 }
86}

Callers

nothing calls this directly

Calls 2

printMatrixMethod · 0.95
multiplyMethod · 0.95

Tested by

no test coverage detected