#include <stdio.h>
#define rows 10
#define cols 10
int main() {
    int a[rows][cols],i,j,m,n,sum;
    printf("enter the order of matrix(m,n)\n");
    scanf("%d%d",&m,&n);
    printf("enter the elements of array\n");
    for(i=1;i<=m;i++)
    {
        for(j=1;j<=n;j++)
        {
            scanf("%d",&a[i][j]);
        }
    }
    printf("elements of 2d array are:\n");
    for(i=1;i<=m;i++)
    {
        for(j=1;j<=n;j++)
    printf("%4d",a[i][j]);
    printf("\n");  
    }
    for(i=0;i<m;i++)
    {
    for(j=0;i<n;j++)
    sum+=a[i][j];
    }
return 0;
}
   

Embed on website

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