Write a program to display multiplication of two matrices.
Answers
Matrix multiplication in C
#include <stdio.h>
int main()
{
int m, n, p, q, c, d, k, sum = 0;
int first[10][10], second[10][10], multiply[10][10];
printf("Enter number of rows and columns of first matrix\n");
scanf("%d%d", &m, &n);
printf("Enter elements of first matrix\n")
Hope it helps!
Mark me as Brainlist!
Multiplication of two matrices in c programming
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int m1[2][3],m2[3][4],m3[2][4],i,j,k;
printf("Enter the elements of matrix first");
for(i=0;i<2;i++)
{
for(j=0;j<3;j++)
{
scanf("%d",&m1[i][j]);
}
}
printf("\nEnter the elements of second matrix");
for(i=0;i<3;i++)
{
for(j=0;j<2;j++)
{
scanf("%d",&m2[i][j]);
}
}
for(i=0;i<2;i++)
{
for(j=0;j<4;j++)
{
m3[i][j]=0;
for(k=0;k<3;k++)
{
m3[i][j]+=m1[i][k]*m2[k][j];
}
}
}
printf("\n The resultant matrix is");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf(" %d",m3[i][j]);
}
}
printf("\n");
getchar();
}