/*PROGRAM TO PERFORM MULTIPLICATION OF TWO MATRICES*/
#include<stdio.h>
#include<conio.h>
void main()
{
int m,n,p,q,i,j,k,a[10][10],b[10][10],c[10][10];
clrscr();
printf(“Enter the order of first matrix: “);
scanf(“%d%d”,&m,&n);
printf(“Enter the order of second matrix: “);
scanf(“%d%d”,&p,&q);
if(n==p)
{
printf(“Enter the %d elements of first matrix:\n”,m*n);
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
scanf(“%d”,&a[i][j]);
}
printf(“Enter the %d elements of second matrix:\n”,p*q);
for(i=0;i<p;i++)
{
for(j=0;j<q;j++)
scanf(“%d”,&b[i][j]);
}
printf(“The first matrix of %d*%d order is:\n”,m,n);
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
printf(“%4d”,a[i][j]);
printf(“\n”);
}
printf(“The second matrix of %d*%d order is:\n”,p,q);
for(i=0;i<p;i++)
{
for(j=0;j<q;j++)
printf(“%4d”,b[i][j]);
printf(“\n”);
}
//MULTIPLYING THE MATRICES
printf(“The %d*%d matrix obtained after multilication is:\n”,m,q);
for(i=0;i<m;i++)
{
for(k=0;k<q;k++)
{
c[i][k]=0;
for(j=0;j<n;j++)
c[i][k]=c[i][k]+a[i][j]*b[j][k];
printf(“%4d”,c[i][k]);
}
printf(“\n”);
}
}
else
printf(“Matrix multiplication is not possible”);
getch();
}