Write a java program to multiply two matrices and output the resultant matrix.

Example:

Before the starting the process of matrix multiplication first we need to check the order of the two given matrix, whether they can be multiplied or not because two matrices A and B can only be multiplied if the number of columns in A is equal to the number of rows in B.

Matrix multiplication in C

Also, the order of the resultant matrix is:

  • row = number of rows in A
  • col = number of columns in B

If all is well, then we need to multiply matrices as done in standard mathematical matrix multiplication.

Output

If you have any doubts or suggestion then comment below.

Leave a Reply

Close Menu