Cody

# Problem 314. Find the sum of the elements in the "second" diagonal

Solution 1643070

Submitted on 11 Oct 2018 by amirhosein alimohammadi
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
x = magic(6); y_correct = 111; assert(isequal(sum_of_sec_diag(x),y_correct))

a = 6 b = 6 sum = 24 sum = 47 sum = 69 sum = 102 sum = 107 sum = 111

2   Pass
x = magic(10); y_correct = 505; assert(isequal(sum_of_sec_diag(x),y_correct))

a = 10 b = 10 sum = 40 sum = 104 sum = 167 sum = 229 sum = 290 sum = 380 sum = 469 sum = 482 sum = 494 sum = 505

3   Pass
x = magic(11); y_correct = 671; assert(isequal(sum_of_sec_diag(x),y_correct))

a = 11 b = 11 sum = 66 sum = 131 sum = 195 sum = 258 sum = 320 sum = 381 sum = 441 sum = 500 sum = 558 sum = 615 sum = 671

4   Pass
x=[1 2 3; 4 4 6; 2 8 9]; y_correct = 9; assert(isequal(sum_of_sec_diag(x),y_correct))

a = 3 b = 3 sum = 3 sum = 7 sum = 9