Question: Given a 2D array a, compute the sum of the forward diagonal (shaded) as well as sum of the backward diagonal (bold font). Using only
Given a 2D array a, compute the sum of the forward diagonal (shaded) as well as sum of the backward diagonal (bold font). Using only one loop, Complete the code to compute both sums. For example, if a is 4 times 4 matrix: then The forward diagonal sum is: 18 The backward diagonal sum is: 21 include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
