#include <stdio.h>
void main()
{
int a[10][10],b[10][10],c[10][10],r1,r2,c1,c2,i,j,k;
printf("\n Matrix Multiplication \n");
printf("\n Size Of First Matrix Row : ");
scanf("%d",&r1);
printf("%d",r1);
printf("\n Size Of First Matrix Coloumn: ");
scanf("%d",&c1);
printf("%d",c1);
printf("\n Size Of Second Matrix Row : ");
scanf("%d",&r2);
printf("%d",r2);
printf("\n Size Of Second Matrix Coloumn : ");
scanf("%d",&c2);
printf("%d",c2);
if(c1==r2)
{
printf("\n Enter the First Matrix Elements : ");
for(i=0;i<r1;i++)
{
for(j=0;j<c1;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("\n Second Matrix Elements : ");
for(i=0;i<r2;i++)
{
for(j=0;j<c2;j++)
{
scanf("%d",&b[i][j]);
}
}
printf("\n First Matrix : \n");
for(i=0;i<r1;i++)
{
printf("\n ");
for(j=0;j<c1;j++)
{
printf(" %d \t",a[i][j]);
}
}
printf("\n\n Second Matrix : \n");
for(i=0;i<r2;i++)
{
printf("\n ");
for(j=0;j<c2;j++)
{
printf(" %d \t",b[i][j]);
}
}
printf("\n\n Multiplication Of Two Matices is : \n");
for(i=0;i<r1;i++)
{
printf("\n ");
for(j=0;j<c2;j++)
{
c[i][j]=0;
for(k=0;k<r2;k++)
{
c[i][j]=c[i][j]+a[i][k]*b[k][j];
}
printf(" %d \t",c[i][j]);
}
}
printf("\n");
}
else
{
printf("\n\nMatrix multiplication is not possible.\n");
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: