#include<stdio.h>
#include<math.h>

int main()
{
    int A[100][100],B[100][100],sum[100][100];
    int i,j,n,c,r;

    printf("\nHow many Rows?: ");
    scanf("%d",&r);
    printf("How many Columns?: ");
    scanf("%d",&c);
    
    printf("\nEnter elements of 1st matrix A: \n");
    for ( i = 0; i < r; i++)
    {
        for ( j = 0; j < c; j++)
        {
            printf("Enter Element A%d%d: ",i+1,j+1);
            scanf("%d",&A[i][j]);
        }
    }
    
    printf("\nEnter elements of 2nd matrix B: \n");
    for ( i = 0; i < r; i++)
    {
        for ( j = 0; j < c; j++)
        {
            printf("Enter Element B%d%d: ",i+1,j+1);
            scanf("%d",&B[i][j]);
        }
    }
    
    for ( i = 0; i < r; i++)
    {
        for ( j = 0; j < c; j++)
        {
            sum[i][j] = A[i][j] + B[i][j];
        }
    }
    
    for ( i = 0; i < r; i++)
    {
        for ( j = 0; j < c; j++)
        {
            printf("%d ",sum[i][j]);
            if ( j == c -1 )
            {
                printf("\n");
            }
        }
    }
}
