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

int enterdata(){

    int c1,r1,c2,r2;
    int A[10][10], B[10][10];
    int i=0;
    int j=0;
    
    printf("Enter Row of Matrix 1: ");
    scanf("%d",&r1);
    printf("Enter Column of Matrix 1: ");
    scanf("%d",&c1);
    printf("Enter Row of Matrix 2: ");
    scanf("%d",&r2);
    printf("Enter Column of Matrix 2: ");
    scanf("%d",&c2);

    printf("\nEnter elements of 1st matrix A: \n");
    for ( i = 0; i < r1 ; i++)
    {
        for ( j = 0; j < c1; 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 < r2 ; i++)
    {
        for ( j = 0; j < c2; j++)
        {
            printf("Enter Element B%d%d: ",i+1,j+1);
            scanf("%d",&B[i][j]);
        }
        
    }
    return 0;
}

int addition(){

    int c1,c3,r3,sum[10][10];
    int A[10][10], B[10][10];
    int i=0;
    int j=0;

    for ( i = 0; i < r3; i++)
    {
        for ( j = 0; j < c3; j++)
        {
            sum[i][j] = 0;
        }
    }

    for ( i = 0; i < r3; i++)
    {
        for ( j = 0; j < c3; j++)
        {
            sum[i][j] = A[i][j] + B[i][j];
        }
    }

    printf("\n\nMatrix Addition\n");
    
    for ( i = 0; i < r3; i++)
    {
        for ( j = 0; j < c3; j++)
        {
            printf("%d\t",sum[i][j]);
            
            if ( j == c3 -1 )
            {
                printf("\n");
            }
        }
    }
    return 0;
}
int main()
{
    enterdata();
    addition();
}