C PROGRAM TO DISPLAY MULTIPLICATION OF 2 MATRICES

This is a simple C program, which will accept two matrices and print there multiplication.

 

#include<stdio.h>
#include<conio.h>

void main()
{
int mat1[4][3],mat2[4][3],i,j;
printf(“\n_________________________________________________\n”);

//To scan 1st matrix

printf(“Enter the matrix 1:\n”);
for(i=0;i<4;i++)
{
for(j=0;j<3;j++)
{
scanf(“%d”,&mat[i][j]);
}
}

 

printf(“\n_________________________________________________\n”);

//To scan 2nd matrix

printf(“Enter the matrix 2:\n”);
for(i=0;i<4;i++)
{
for(j=0;j<3;j++)
{
scanf(“%d”,&mat2[i][j]);
}
}

 

printf(“\n_________________________________________________\n”);

//Multiplication

for(i=0;i<4;i++)
{

for(j=0;j<3;j++)
{
printf(“%d “,mat1[i][j]*mat2[i][j]);
}
printf(“\n”);
}

getch();
}

Thanks for your comment..