Write A C Program To Find The Sum Of The Elements In The Matrix.

Write a C program to find the sum of the elements in the matrix.
Input Format:The input consists of (m*n+2) integers.The first integer corresponds to m, the number of rows in the matrix and the second integer corresponds to n, the number of columns in the matrix.The remaining integers correspond to the elements in the matrix. The elements are read in row-wise order, the first row first, then second row and so on. Assume that the maximum value of m and n is 10.
Output Format:Refer sample output for details.[All text in bold corresponds to the input and the rest corresponds to output]Sample Input and Output1:Enter the number of rows in the matrix3Enter the number of columns in the matrix2Enter the elements in the matrix4 56 90 3The sum of the elements in the matrix is 27

Program Code:#include#includeint** create(int m, int n){    int **a, i;    a= (int **)malloc(m*sizeof(int *));    for(i=0; i    {        *(a+i) = (int *)malloc(n*sizeof(int ));    }    return a;}void read(int **a, int m, int n){    int i, j;    for(i=0; i    {        for(j=0; j        {            scanf("%d", (*(a+i)+j));        }    }}int findSum(int **a, int m, int n){    int i, j;    int sum=0;    for(i=0; i    {        for(j=0; j          {              sum = sum + *(*(a+i)+j);          }    }    return sum;}int main(){    int **a, m, n;    printf("Enter the number of rows in the matrix\n");    scanf("%d",&m);    printf("Enter the number of columns in the matrix\n");    scanf("%d",&n);    printf("Enter the elements in the matrix\n");    a = create(m,n);    read(a,m,n); printf("The sum of the elements in the matrix is %d", findSum(a,m,n));    return 0;}