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

int main()
{

    int a[5][5],b[5][5],c[5][5],i,j,m,n,p,q;
    printf("Enter no. of rows & colomns of first matrix\n");
        scanf("%d%d",&m,&n);
    printf("Enter no. of rows & colomns of second matrix\n");
        scanf("%d%d",&p,&q);

    if(m!=p || n!=q)
    {
        printf("Matrix addition is not possible");
        exit(0);
    }

    printf("Enter elements into first matrix\n");

    for(i=1; i<=m; i++)
    {
        for(j=1; j<=n; j++)
        {

            scanf("%d",&a[i][j]);
        }

    }


    printf("Enter elements into second matrix\n");

    for(i=1; i<=p; i++)
    {
        for(j=1; j<=q; j++)
        {

            scanf("%d",&b[i][j]);
        }

    }


    for(i=1; i<=m; i++)
    {
        for(j=1; j<=q; j++)
        {

            c[i][j]= a[i][j] - b[i][j];
        }

    }

    printf("The Matrix Subtraction is:\n");



    for(i=1; i<=m; i++)
    {
        for(j=1; j<=n; j++)
        {

            printf("%d\t",c[i][j]);
        }
        printf("\n");
    }

    return 0;
}
     
           
Note: Need to be arranged in compiler after copied
   

 OutPut:

Enter no. of rows & colomns of first matrix 2 2 Enter no. of rows & colomns of second matrix 2 2 Enter elements into first matrix 2 4 6 8 Enter elements into second matrix 1 2 3 4 The Matrix Subtraction is: 1 2 3 4