diff --git a/MatrixMultiply.java b/MatrixMultiply.java new file mode 100644 index 0000000..a4a6284 --- /dev/null +++ b/MatrixMultiply.java @@ -0,0 +1,52 @@ +import java.util.*; +public class MatrixMultiply{ + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + System.out.println("Enter the number of rows of matrix A: "); + int n1 = sc.nextInt(); + System.out.println("Enter the number of columns of matrix A: "); + int m1 = sc.nextInt(); + System.out.println("Enter the number of rows of matrix B: "); + int n2 = sc.nextInt(); + System.out.println("Enter the number of columns of matrix B: "); + int m2 = sc.nextInt(); + int[][] A = new int[n1][m1]; + int[][] B = new int[n2][m2]; + if(m1!=n2){ + System.out.println("Matrix A and Matrix B are not of same size"); + System.exit(0); + } + for(int i=0;i