0

To find multiplication of two matrices

#include <stdio.h> #include<stdlib.h> int main() { int m, n, c, d,k, first[10][10], second[10][10], mul[10][10]; printf("Enter the number of rows and columns of matrix\n"); scanf("%d%d", &m, &n); printf("Enter the elements of first matrix\n"); for (c = 0; c < m; c++) for (d = 0; d < n; d++) scanf("%d", &first[c][d]); printf("Enter the elements of second matrix\n"); for (c = 0; c < m; c++) for (d = 0 ; d < n; d++) scanf("%d", &second[c][d]); printf("multiply of entered matrices:-\n"); for (c = 0; c < m; c++) { for (d = 0 ; d < n; d++) { mul[c][d] =0; for(k=0;k<n;k++) { mul[c][d]+=first[c][k]*second[k][d]; } } }//for printing result for(c=0;c<m;c++) { for(d=0;d<n;d++) { printf("%d\t",mul[c][d]); } printf("\n"); } return 0; }

2nd Mar 2022, 3:59 PM
Aakash
Aakash - avatar
2 ответов
0
Enter the number of rows and columns of matrix 3 3 Enter the elements of first matrix 1 2 3 4 5 6 2 3 4 Enter the elements of second matrix 2 3 4 2 3 6 2 3 5 multiply of entered matrices:- 12 18 31 30 45 76 18 27 46
2nd Mar 2022, 3:59 PM
Aakash
Aakash - avatar
+ 1
Aakash do you want me to upvote?
2nd Mar 2022, 5:00 PM
NonStop CODING
NonStop CODING - avatar