C language to find the sum of main diagonal and sub diagonal elements in n * n matrix In the n * n matrix (an array of N rows and N columns), find the sum of the main diagonal and sub diagonal elements

C language to find the sum of main diagonal and sub diagonal elements in n * n matrix In the n * n matrix (an array of N rows and N columns), find the sum of the main diagonal and sub diagonal elements

#define N 10;
main()
{
int i,j;
int a[N][N];
int sum=0;
for(i=0;i