0
A(n×n) array.Program to find sum of all elements which lie on either diagonal.
2 Respuestas
+ 3
something better
for(I=0;I<size;I++)
sum+=ar[I][I]+ar[I][size-i-1];
if(size%2!=0)
sum-=ar[size/2][size/2];
0
1 take two loops i & j
2 if i == j
3 then sum = sum + array[i][j]