#include <stdio.h>

int main() {
    int r,c,a[10][10],b[10][10],sum[10][10],i,j;
    
    printf("enter number of r(between 1 and 10):");
    scanf("%d", &r);

    printf("enter number of c(between 1 and 10):");
    scanf("%d", &c);

    printf("\nenter elements of 1st matrix:\n");
        for (i=0;i<r;++i)
        for (i=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:\n");
        for (i=0;i<r;i++)
        for (i=0;j<c;j++)

        {printf("enter element a %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];}
    printf("\n sum of 2 matrices\n");
        for (i=0;i<r;++i)
        for (i=0;j<c;++j)

    printf("%d",sum[i][j]);
        if(j ==c-1)
        {printf("\n\n");}
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: