##### Write a program that initializes values in two tables A and B. It adds tables A and B and stores result into table C. It also displays the values of three tables in tabular form on the screen.

##### Note: The addition of matrices A and B is obtained by adding the elements of A to the corresponding elements of B. To add/subtract two matrices, the number of rows and columns of two matrices must be equal. For example:

##### A = ad be cf B = gj hk il

A + B = (a + g)(d + j) (b + h)(e + k) (c + i)(f + l)

Addition of matrices.

**So let’s Write Code:**

## Code:

** Write a program that initializes values in two tables A and B. It adds tables A and B and stores result into table C. It also displays the values of three tables in tabular form on the screen. **

```
#include<iostream>
using namespace std;
main()
{
int A[3][3] = {{2,3,8},{5,8,3},{2,6,3}};
int B[3][3] = {{2,3,1},{6,1,2},{6,2,1}};
int C[3][3];
void addition(int[3][3], int[3][3], int [3][3]);
void print(char [15], int [3][3]);
addition(A, B, C);
print("Matrix A: ", A);
print("Matrix B: ", B);
print("addition of A & B ", C);
}
```**// definition of addition() function**
void addition(int X[3][3], int Y[3][3], int Z[3][3])
{
int r, c;
for(r = 0; r<=2; r++)
for(c = 0; c<=2; c++)
Z[r][c] = X[r][c]+Y[r][c];
}
**// definition of print() function**
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/