Write a ‘C’ program to calculate the sum of element of mXn matrix

#include<stdio.h>
#include<conio.h>
void main()
{
int a[10][10],r,c;
int sum=0,i=0,j=0;
clrscr();
printf("\n enter the row and coloum\n");
scanf("%d%d",&r,&c);
printf("\n enter the matrix elements\n");
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
scanf("%d",&a[i][j]);
}
}
printf("\n the matrix elements are\n\n");
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
printf("\t%d",a[i][j]);
}
printf("\n");
}
printf("\n sum of elements\n");
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
sum=sum+a[i][j];
}
}
printf("\n the elements sum=%d",sum);
getch();
}

Comments