You are viewing a single comment's thread. Return to all comments →
I went for a non-array approach. Feedback much appreciated :)
for(int j = 0; j < numInputs; j++){ for(int k = 0; k < numInputs; k++){ cin >> curInput; if(j == k){ leftD += curInput; } if(j+k == (numInputs-1)){ rightD += curInput; } } } ans = abs(leftD-rightD);
Seems like cookies are disabled on this browser, please enable them to open this website
Diagonal Difference
You are viewing a single comment's thread. Return to all comments →
I went for a non-array approach. Feedback much appreciated :)