write a program to find the product or multiplication of two matrices.

#include<stdio.h>
#include<conio.h>
int main()
{
int a[3][3],b[3][3],c[3][3],sum=0,i,j,k;
printf("enter value of first matrix\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
scanf("%d",&a[i][j]);
}
printf("enter value of 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++)
{
sum=0;
for(k=0;k<3;k++)
sum=sum+a[i][k]*b[k][j];
c[i][j]=sum;
}
}
printf("multiplication of two matrix\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
printf("%d\t",c[i][j]);
printf("\n");
}
return 0;

Comments

Popular posts from this blog

write a program for insertion sort with example.