Sunday, 19 March 2017

MULTIPLICATION OF MATRIX IN C++

Tags

Program : Multiply two matrix in C++.

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int sum=0,a1[30][30],a2[30][30],a3[30][30],i,j,k;
cout<<"Enter first Matrix";
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cin>>a1[i][j];
}
}
cout<<"Enter element of second matrix";
{
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cin>>a2[i][j];
}
}
}
cout<<"\nMultiplication of two matrix..\n";
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
sum=0;
for(k=0;k<3;k++)
{
sum=sum+a1[i][k]*a2[k][j];
}
a3[i][j]=sum;
}
//a3[i][j]=sum;
}
cout<<"\nResultant Matrix..\n";
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
cout<<m3[i][j]<<" ";
}
cout<<"\n";
}
getch();

}


This Is The Newest Post