Find the sum of diagonal elements of a matrix

This program matches the X and Y co-ordinate of the matrix and calculates the sum where the co-ordinates match.Each and every element of the matrix is considered using two for loops.The first for loop considers row of the matrix and second for loop considers column of the matrix.The variable sum stores the sum of diagonal elements.The element whose row number matches with column number is called as diagonal element.Such elements are added to variable sum which gives the sum of diagonal elements when both the for loops end.

#include < stdio.h >
#include < conio.h > 

void main()
{
	int a[10][10],i,j,sum=0,r,c;
	clrscr();
	printf("\n Enter the number of rows and column ");
	scanf("%d%d",&r,&c);
	printf("\nEnter the %dX%d matrix",r,c);
	for(i=0;i < r;i++)
	{
		for(j=0;j < c;j++)
		{
			scanf("%d",&a[i][j]);
		}//for
	}//for
	for(i=0;i < r;i++)
	{
		for(j=0;j < c;j++)
		{
			if(i==j)
			{
				sum+=a[i][j];
			}
		}//for
	}//for
	printf("\nThe sum of diagonal elements is %d",sum);
}//main