#include <stdio.h>
#define s 20
int main() {
    int a[s][s],i,j,r,c,sum=0;

    printf("\nEnter order of matrix:");
    scanf("%d%d",&r,&c);
    for(i=0;i<r;i++)
    {
        for(j=0;j<c;j++)
        scanf("%d",&a[i][j]);
    }
    printf("\n Given Mtrix:\n");
    for(i=0;i<r;i++)
    {
        for(j=0;j<c;j++)
        {
            printf("%5d",a[i][j]);
            sum=sum+a[i][j];
        }
        
        printf("\n");
    }
    printf("\nSum of every element of matrix: %d",sum);
    return 0;
}

Embed on website

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