1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44  #include <stdio.h>
#include <stdlib.h>
//Program for Multiplication of matrix 3*3 Time and Update
int main()
{
int a[3][3],b[3][3],c[3][3];
int i,j,k,tmp1=0,tmp2=0,tmp3=0;
printf("Enter value of matrix A \n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf("%d",&a[i][j]);
printf("\n");
}
printf("Enter value of matrix B \n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf("%d",&b[i][j]);
printf("\n");
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
tmp1=a[i][j]*b[j][0]+tmp1;
tmp2=a[i][j]*b[j][1]+tmp2;
tmp3=a[i][j]*b[j][2]+tmp3;
}
c[i][0]=tmp1;
c[i][1]=tmp2;
c[i][2]=tmp3;
}
printf("https://timeandupdate.com \n");
printf("The Multiplication is :\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
printf("%d\t",c[i][j]);
printf("\n");
}
return 0;
}

Here is the Output:
I did not check all but looks its correct. 
The above program is compiled and successfully run on Code::Block 13.12.
This is easy program but you just need to focus. If you cant understand how this program flow don't forget to comment we will be back to help you.
0 comments:
Post a Comment