void matmul(int[][],int[][],int,int,int,int);
main()
{
int matrix_1[20][20],matrix_2[20][20],i,j,r1,r2,c1,c2;
printf("Enter the number of rows and columns of first matrix :\t");
scanf("%d%d",&r1,&c1);
printf("Enter the number of rows and columns of second matrix :\t");
scanf("%d%d",&r2,&c2);
if(c1==r2)
{
printf("Enter the elements of first matrix :\n");
for(i=0;i
{
for(j=0;j
{
scanf("%d",&matrix_1[i][j]);
}
}
printf("The first matrix is :\n");
for(i=0;i
{
for(j=0;j
{
printf("%d\t",matrix_1[i][j]);
}
printf("\n");
}
printf("Enter the elements of first matrix :\n");
for(i=0;i
{
for(j=0;j
{
scanf("%d",&matrix_2[i][j]);
}
}
printf("The second matrix is :\n");
for(i=0;i
{
for(j=0;j
{
printf("%d\t",matrix_2[i][j]);
}
printf("\n");
}
matmul(matrix_1,matrix_2,r1,c1,r2,c2);
}
else
printf("Multiplication not possible.\n");
}
void matmul(int num1[20][20],int num2[20][20],int r1,int c1,int r2,int c2 )
{
int k,c[30][30],i,j;
printf("The product matrix is :\n");
c[i][j]=0;
for(i=0;i
{
for(j=0;j
{
for(k=0;k
{
c[i][j]=c[i][j]+(num1[i][k]*num2[k][j]);
}
}
}
for(i=0;i
{
for(k=0;k
{
printf("%d\t",c[i][k]);
}
printf("\n");
}
}
could u help to give the matrix multiplication in mplabc30 compiler
ReplyDeleteyes sure..
ReplyDeleteit shows errornious values
ReplyDeletebad
ReplyDelete