MATRIX_M.CPP

 	      //////////////////////////////////////////////
      //                                          //
      //       Program To Multiply Two Matrix     //
      //             Authar: Kaustubh             //
      //                                          //
      //////////////////////////////////////////////

#include<iostream.h>
#include<conio.h>

void main()
{

// Decleration //

int a[3][3],b[3][3],c[3][3],d=0,i=0,j=0,k=0;

clrscr();

// Inputes //

cout<<"Please enter the first matrix\n\n";

for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cin>>a[i][j];
}
}

cout<<"\nPlease enter the second matrix\n\n";
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cin>>b[i][j];
}
}

// Logic //

cout<<"\n\nThe logic of progam is \n\n";

for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
for(k=0;k<3;k++)
{
d=d+(a[j][k]*b[k][j]);
cout<<(a[j][k]*b[k][j]);
if(k<2)
{
cout<<"+";
}
}
c[i][j]=d;
d=0;
cout<<"  ";
}
cout<<"\n";
}

// Resualt //

cout<<"\n\nThe resualt of matrix multiplication is \n\n";
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cout<<"  "<<c[i][j];
}
cout<<"\n";
}

getch();
}

Project Homepage: