# ALGORITHM:

Step 1: Start

Step21: for i is 0 to 2 by step 1 for j is 0 to 2 by step 1

Step 4: goto step 2

Step 5: calculate c[i][j]=a[i][j]+b[i][j]

Step 6: goto step 2

Step 7: Print c[i][j]

Step 8: Stop

# Write a C program to perform the addition of two matrices

``````#include <stdio.h>
#include <conio.h>

void main()
{
int a, b, c;
int i, j;
clrscr();
printf("ENTER A MATRIX\n");
for (i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++)
scanf("%d", &a[i][j]);
}
printf("ENTER B MATRIX\n");
for (i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++)
scanf("%d", &b[i][j]);
}
for (i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++)
c[i][j] = a[i][j] + b[i][j];
}
printf(" After addition of two matrices :\n");
for (i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++)
{
printf("%d\t", c[i][j]);
}
printf("\n");
}
getch();
}
``````

INPUT:

``````ENTER a MATRIX
1 2 3
4 5 6
7 8 9
ENTER b MATRIX
1 1 1
1 1 1
1 1 1
``````

OUTPUT:

``````After addition of two matrices is..
2 3 4
5 6 7
8 9 10 ``` ```

# Free Spring Boot Tutorial - 5 Hours Full Course

Watch this course on YouTube at Spring Boot Tutorial | Fee 5 Hours Full Course