You are viewing a single comment's thread. Return to all comments →
Slightly cleaner and more readable:
int diag1 = 0, diag2 = 0; for(int p = 0; p<n; p++) { diag1 += a[p][p]; diag2 += a[p][n - (p + 1)]; }
Diagonal Difference
You are viewing a single comment's thread. Return to all comments →
Slightly cleaner and more readable: