#include<stdio.h>
#include<conio.h>
void main()
{
int a[10][10],b[10][10],i,j,m,n,m1,n1,k,c[10][10];
clrscr();
printf("\nenter the size of first matrix");
scanf("%d%d",&m,&n);
printf("\nenter the size of second matrix");
scanf("%d%d",&m1,&n1);
if(n!=m1)
{
printf("\nyou have entered a wrong choice");
getch();
exit(0);
}
else
{
printf("\nenter the elements in the first matrix");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("\neneter the elements in the second matrix");
for(i=0;i<m1;i++)
{
for(j=0;j<n1;j++)
{
scanf("%d",&b[i][j]);
}
}
for(i=0;i<m;i++)
{
for(j=0;j<n1;j++)
{
c[i][j]=0;
for(k=0;k<n;k++)
{
c[i][j]=c[i][j]+(a[i][k] * b[k][j]);
}
}
}
printf("\nthe required matrix after multiplication is=\n");
for(i=0;i<m;i++)
{
for(j=0;j<n1;j++)
{
printf("\t%d",c[i][j]);
}
printf("\n");
}
getch();
}
}