Description: This program performs the multiplication of two Square Matrices.
/*program to find product of two matrices (3X3)*/
#include
#include
void main()
{
int a[3][3],b[3][3],c[3][3],i,j,k;
clrscr();
printf("enter the first matrix\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("enter the second matrix\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
scanf("%d",&b[i][j]);
}
}
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
c[i][j]=0;
}
}
for(k=0;k<3;k++)
{
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
c[k][i]=a[k][j]*b[j][i]+c[k][i];
}
}
}
printf("product of matrix is\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf("%d\t",c[i][j]);
}
printf("\n");
}
getch();
}