Java Program for Matrix Multiplication

Here you will get java program for matrix multiplication.

Suppose we have matrix A with number of rows and columns as m and n. Let B be a matrix with number of rows and columns as p and q. Their multiplication is possible only if number of columns of matrix A is equal to number of rows of matrix B i.e. n should be equal to p. The resultant matrix is of order mxq.

Java Program for Matrix Multiplication

Also Read: Java Program for Matrix Addition

Java Program for Matrix Multiplication

Output

Enter number of rows and columns of first matrix:
2
2
Enter number of rows and columns of second matrix:
2
2
Enter elements of first matrix row wise:
4 5
6 7
Enter elements of second matrix row wise:
1 2
4 3
Matrix after multiplication:
24 23
34 33

Leave a Reply

Your email address will not be published. Required fields are marked *