##### Write a program to initialize values in two tables A and B. Multiply matrix A and B and store result into table C. Display the values of three matrices in tabular form on the screen.

Note: The multiplication of two matrices A and B is possible only when the number of columns of matrix A is equal to number of rows of matrix B. For example, two matrices A and B are multiplied as:

**So let’s Write Code:**

###### Write a program to initialize values in two tables A and B. Multiply matrix A and B and store results into table C | Multiplication of matrices.

```
#include<iostream.h>
Using namespace std;
void multiply(int [3][3], int[3][3], int [3][3]);
void print(char [25], int [3][3]);
main()
{
int A[3][3] = {{2,3,8},{4,5,3},{2,6,3}};
int B[3][3] = {{3,9,1},{1,2,4},{6,2,1}};
int C[3][3];
multiply(A, B, C);
print("Matrix A: ",A);
print("Matrix B: ",B);
print("Multiplication of A & B: ",C);
}
// function for multiplying data of tables
void multiply(int X[3][3], int Y[3][3], int Z[3][3])
{
int r, c, k, sum;
for(r = 0; r<=2; r++)
{
for(c = 0; c<=2; c++)
{
for(k = 0, sum = 0; k<=2; k++)
sum = sum + X[r][k] * Y[k][c];
Z[r][c] = sum;
}
}
}
// function for displaying data of tables in tabular form
void print(char str[], int R[3][3])
{
int r, c;
cout<<endl<<str<<endl;
for(r = 0; r<=2; r++)
{
for(c = 0; c<=2; c++)
cout<<R[r][c]<<"\t";
cout<<endl;
}
}
```

**Hope You will learn Something. Happy Coding.**

###### Visit my YouTube Channel as WellðŸ˜‡ https://www.youtube.com/watch?v=JuIHQ9cLSEw&list=PLbIhkHxfUIItTdcyCb34uRIrPJbXBndIl&index=4

**Click on the below Links for more Programming Exercises: **

**Conditional Structure Exercises: **ðŸ‘‰https://myustaadg.com/category/programming-exercises/conditional-structures-exercises/

**Array Exercises: ðŸ‘‰**https://myustaadg.com/category/programming-exercises/arrays-exercises/