C Program to Multiply two Matrices.
In this example, we will calculate the product of the two matrices allowing the user to enter their required number of rows and columns. In matrix multiplication the number of columns, in the first matrix must be equal to the number of rows in the second matrix, otherwise multiplication is not possible. The product will have the number of rows of the first matrix and the number of columns of the second matrix.
Here in the output we have taken two matrices of order 2x3 and 3x2. The resulting matrix after calculating the product will be of the order 2x2.
PROGRAM
OUTPUT
Enter the row size of the 1st Matrix : 2
Enter the column size of the 1st Matrix : 3
Enter the elements of the 1st Matrix : 0
-1
2
4
11
2
Enter the row size of the 2nd Matrix : 3
Enter the column size of the 2nd Matrix : 2
Enter the elements of the 2nd Matrix : 3
-1
1
2
6
1
Multiplication of the two matrices is :
11 0
35 20
NOTE: You Can Comment Your Code if you have solved differently and we will pin it in the comment section. Let's Learn together.
MOTTO:
You Learn, I Learn together We Learn.
Comments
Post a Comment
Please do not spam any link