Martices Multiplication
/*program to the Multiplication of 2 matrices*/
#include<stdio.h>
#include<conoi.h>
void main()
{
int i,j,k,m,n,p,q,a[2][2],b[2][2],sum[2][2];
printf("\n Enter the base of first matrix:");
scanf("%d %d",&m,&n);
printf("\n Enter the base of second matrix:");
scanf("%d %d",&p,&q);
if(n==p)
{
printf("\n Enter the elements of first matrix :");
for(i=0;i<=m;i++)
{
for(j=0;j<=n;j++)
{
scanf("%d",&a([i][j);
}
}
printf("\ Enter the elements of second matrix:\n ");
for(i=0;i<=p;i++)
{
for(j=0;j<=q;j++)
{
scanff("%d",&b([i][j]);
}
}
/* Logic Starts Here */
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
mul[i][j]=0;
for(k=0;K<q;k++)
{
mul[i][j]=mul[i][j]+a[i][k]*b[k][j];
}
}
}
printf("\n Multiplication of matrices is............ \n");
for(i=0;i<=p;i++)
{
for(j=0;j<=q;j++)
{
p[rintf("%d",mul[i][j];
}
printf("\n ");
}
}
else
{
printf("\n ---------Matrix multiplication is not possible --------");
}
}