Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #define NR 10
- #define NC 10
- int main()
- {
- typedef int mat[NR][NC];
- mat a;
- int b[2][3]={ {1, 2, 3}, {4, 5, 6} };
- int c[3][2]={ {1, 2}, {1,2}, {1,2} },
- d[2][2]={0};
- int n,m; // dimensione della matrice
- int i,j, //indici della matrice b c
- z,y;
- printf("\n Visualizzazione prima matrice\n");
- printf("\n");
- for(i=0;i<2;i++)
- {
- for(j=0;j<3;j++)
- {
- printf(" %d",b[i][j]);
- }
- printf("\n");
- }
- printf("\n Visualizzazione seconda matrice\n");
- printf("\n");
- for(i=0;i<2;i++)
- {
- for(j=0;j<2;j++)
- {
- printf(" %d",c[i][j]);
- }
- printf("\n");
- }
- //prodotto delle due matrici
- for (i=0; i<2; i++) {
- for (j=0; j<2; j++) {
- for (z=0; z<3; z++) {
- d[i][j]= d[i][j]+(b[i][z]*c[z][j]);}}}
- printf("\n Visualizzazione prodotto matrice\n");
- printf("\n");
- for(i=0;i<2;i++)
- {
- for(j=0;j<2;j++)
- {
- printf(" %d",d[i][j]);
- }
- printf("\n");
- }
- printf("\n");
- system("pause");
- return 0;}
Add Comment
Please, Sign In to add comment