Dr. A.P.J. Abdul Kalam Technical University (AKTU), Lucknow

Lab Exercise

29. Write a program to print the multiplication of two N*N (Square) matrix.

Sample Input and Output

Stdin Inputs:

3 5 6 1 2 4 8 3 7 9 9 4 7 3 8 5 1 6 2

Sample Result:

Input no of rows or columns: 3

***Input first matrix***
Input element 1, 1: 5
Input element 1, 2: 6
Input element 1, 3: 1
Input element 2, 1: 2
Input element 2, 2: 4
Input element 2, 3: 8
Input element 3, 1: 3
Input element 3, 2: 7
Input element 3, 3: 9

***Input second matrix***
Input element 1, 1: 9
Input element 1, 2: 4
Input element 1, 3: 7
Input element 2, 1: 3
Input element 2, 2: 8
Input element 2, 3: 5
Input element 3, 1: 1
Input element 3, 2: 6
Input element 3, 3: 2

***First Matrix***
5     6     1
2     4     8
3     7     9

***Second Matrix***
9     4     7
3     8     5
1     6     2

***Multiplication of Matrices***
64     74     67
38     88     50
57     122     74

Leave a Reply

Your email address will not be published.

Exit mobile version