Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void parr(int x[3][3])
- {
- int i,j;
- for(i=0 ; i<3 ; i++){
- for(j=0 ; j<3 ; j++)
- printf("%d\t",x[i][j]);
- printf("\n");
- }
- printf("\n");
- }
- int main()
- {
- int am[3][3], bm[3][3],cm[3][3]={0},i,j,k;
- printf("Enter A-Matrix 3X3, Rows-Columns: "); //input of the A-Matrix
- for(i=0 ; i<3 ; i++)
- for(j=0 ; j<3 ; j++)
- scanf("%d",&am[i][j]);
- printf("Enter B-Matrix 3X3, Rows-Columns: "); //input of the B-Matrix
- for(i=0 ; i<3 ; i++)
- for(j=0 ; j<3 ; j++)
- scanf("%d",&bm[i][j]);
- printf("A-Matrix is:\n");
- parr(am);
- printf("B-Matrix is:\n");
- parr(bm);
- for(i=0 ; i<3 ; i++) //Calculations for C-Matrix
- for(j=0 ; j<3 ; j++)
- for(k=0 ; k<3 ; k++)
- cm[i][j]+=am[i][k]*bm[k][j];
- printf("C=AxB : \n");
- parr(cm);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement