PROGRAM TO MULTIPLY OF TWO MATRICES
#include<stdio.h>
#include<conio.h>
void main()
{
int a[3][3],b[3][3],c[3][3],i,j,k;
clrscr();
printf("\nEnter the element of matrix a:\n\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
scanf("%d",&a[i][j]);
}
printf("\n");
}
printf("\nEnter the element of matrix b:\n\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
scanf("%d",&b[i][j]);
}
printf("\n");
}
printf("\nThe multiple matrix of a and b matrices is\n\n");
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
c[i][j]=0;
for(k=0;k<3;k++)
{
c[i][j]=c[i][j]+a[i][k]*b[k][j];
}
printf("%d",c[i][j]);
}
printf("\n");
}
getch();
}
OUTPUT
Enter the element of matrix a:
2 3 4
2 3 4
2 3 4
Enter the element of matrix b:
4 3 2
4 3 2
4 3 2
The multipal of a and b matrices is:
36 27 18
36 27 18
36 27 18
0 comments »
Leave your response!