void main()
{
int a[10][10],b[10][10],c[10][10];
int i,j,k,r1,c1,r2,c2;
clrscr();
printf("\n how many rows n columns are in matrix a");
scanf("%d%d",&r1,&c1);
printf("\n Enter the elements of matrix a");
for(i=0;i {
{
int a[10][10],b[10][10],c[10][10];
int i,j,k,r1,c1,r2,c2;
clrscr();
printf("\n how many rows n columns are in matrix a");
scanf("%d%d",&r1,&c1);
printf("\n Enter the elements of matrix a");
for(i=0;i
for(j=0;j {
scanf("%d",&a[i][j]);
}
printf("\n");
}
printf("\n how many rows n columns are in matrix b");
scanf("%d%d",&r2,&c2);
printf("\n Enter the elemnts of matrix b");
for(i=0;i {
scanf("%d%d",&r2,&c2);
printf("\n Enter the elemnts of matrix b");
for(j=0;j {
scanf("%d",&b[i][j]);
}
printf("\n");
}
if(c1!=r2)
{
printf("\n matrix mul is nt possible");
exit();
}
printf("\n result is :\n");
for(i=0;i {
for(j=0;j {
c[i][j]=0;
for(k=0;k
{
printf("\n matrix mul is nt possible");
exit();
}
printf("\n result is :\n");
for(i=0;i
for(j=0;j
c[i][j]=0;
for(k=0;k
{
c[i][j]=c[i][j]+a[i][k]*b[k][j];
}//for k
}
}
c[i][j]=c[i][j]+a[i][k]*b[k][j];
}//for k
}
}
printf("\n result is \n");
for(i=0;i
for(i=0;i
{
for(j=0;j
{
printf("\t%d",c[i][j]);
}
printf("\n");
}

0 comments:
Post a Comment