Code:
#include<iostream.h>
void input(int t[][3]);
void product(int a[][3], int b[][3], int c[][3]);
void display(int [][3]);
void main()
{
int a[3][3], b[3][3], c[3][3];
cout << "\tPROGRAM OF PRODUCT OF TWO 3X3 MATRICES\n\nEnter 9 Values for 3x3 Matrix 1 \n";
input(a);
cout << "Enter 9 Values for 3x3 Matrix 2 \n";
input(b);
product(a,b,c);
cout << "\nProduct of two matrices are \n\n";
display(c);
}
void input(int t[][3])
{
int i, j;
for(i=0; i<3; i++)
{
for(j=0; j<3; j++)
cin >> t[i][j];
}
}
void product(int a[][3], int b[][3], int c[][3])
{
int i, j, k;
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] += + a[i][k] * b[k][j];
}
}
}
}
void display(int c[][3])
{
int i, j;
for(i=0; i<3; i++)
{
for(j=0; j<3; j++)
cout << c[i][j] << " ";
cout << "\n";
}
}
This is program for multiplying 3x3 matrices.......hope it will help u a lot