# Multiplication of Matrices

Page 1 of 1

## 1 Replies - 2619 Views - Last Post: 13 May 2012 - 11:06 AM

### #1 PennyBoki

• D.I.C Lover

Reputation: 55
• Posts: 2,345
• Joined: 11-December 06

# Multiplication of Matrices

Posted 28 July 2007 - 01:30 PM

Description: copy/paste/compile/runThe user enters two 3 by 3 matrices and the result is a matrix which is a product of those two.
```//PennyBoki @ </dream.in.code>
#include <iostream.h>

int main()
{
int A[3][3];
int B[3][3];
int C[3][3];
int X[3][3][3];
int i,j,m;

cout<<"==========Enter matrix A==========n";
for(i=0;i<3;i++)
{     cout<<endl;
for(j=0;j<3;j++)
{
cout<<"A["<<i<<"]["<<j<<"]= ";
cin>>A[i][j];
C[i][j]=0;
}
}

cout<<"n==========Enter matrix B==========n";
for(i=0;i<3;i++)
{     cout<<endl;
for(j=0;j<3;j++)
{
cout<<" B["<<i<<"]["<<j<<"]= ";
cin>>B[i][j];
}
}

for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
for(m=0;m<3;m++)
{
X[i][j][m]=A[i][m]*B[m][j];
C[i][j]+=X[i][j][m];
}
}
}

cout<<"n==========matrix C==========n";
for(i=0;i<3;i++)
{     cout<<endl;
for(j=0;j<3;j++)
{
cout<<" C["<<i<<"]["<<j<<"]= "<<C[i][j];

}
}
cout<<endl<<endl;

return 0;
}
```

Is This A Good Question/Topic? 0

## Replies To: Multiplication of Matrices

### #2 zafar alam

Reputation: 0
• Posts: 0
• Joined: 13-May 12

## Re: Multiplication of Matrices

Posted 13 May 2012 - 11:06 AM

very good thanx for submitting this