Sunday, October 21, 2007

programe for multiplication of 2 matrix of any size

/*prg to for multiflication of matrixes
written by sekhar
written on 16/07/07
modified on 18/07/07 */
#include
main()
{
int s,i,j,k,l,m,n,o,x,y,a[6][6],b[6][6],c[6][6],d[6];
printf("enter the order of matrix");
scanf("%d",&s);
printf("enter the elements of first matrix\n");
for(i=0;i{
for(j=0;j{
printf("\nenter(%d,%d)element:",i,j);
scanf("%d",&a[i][j]);
}
printf("\n");
} //scan of first matrix
printf("enter the elements of second matrix\n");
for(k=0;k{
for(l=0;l{
printf("\nenter(%d,%d)element:",k,l);
scanf("%d",&b[k][l]);
}
printf("\n");
} //scan of second matrix
for(m=0;m{
for(n=0;n{
y=0;
for(o=0;od[o]=a[m][o]*b[o][n];
for(x=0;xy=y+d[x];
c[m][n]=y;
printf("\t%d",c[m][n]);
}
printf("\n");
}
}

No comments: