Write a program to find the sum of all the elements of a matrix

#include<stdio.h> int main() { int a[5][5],sum=0,row,column,i,j; printf("Enter matrix size.\n"); scanf("%d%d",&row,&column); printf("Enter elements in an array:\n"); for(i=0;i<row;i++){ for(j=0;j<column;j++){ scanf("%d",&a[i][j]); sum+=a[i][j]; } } printf("Sum = %d",sum); return 0; }

**Output**

Enter matrix size.

2

2

Enter elements in an array:

1

2

3

4

Sum = 10