Algorithm: Multiplication of two matrix

Rule: Multiplication of two matrix is only possible if first matrix has size m X n and other matrix has size n x r. Where m, n and r are any positive integer.

Multiplication of two matrices is defined as

For example: Suppose two matrix A and B of size of 2 x 2 and 2 x 3 respectively

### Example: C++ Program to Multiply Two Matrix Using Multi-dimensional Arrays

#### Output

Enter rows and columns for first matrix: 2

2

Enter rows and columns for second matrix: 2

3

Enter elements of matrix 1

Enter element A11 : 1

Enter element A12 : 2

Enter element A21 : 3

Enter element A22 : 4

Enter elements of matrix 2

Enter element B11 : 5

Enter element B12 : 6

Enter element B13 : 7

Enter element B21 : 8

Enter element B22 : 9

Enter element B23 : 10

Product of entered matrices:-

21 24 27

47 54 61

## Post a Comment