Cody

Solution 698066

Submitted on 8 Jul 2015 by Nicholas Hortance
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))

b = 4 b = 24 b = 24 23 b = 24 23 22 b = 24 23 22 33 b = 24 23 22 33 5 b = 24 23 22 33 5 4

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

b = 11 b = 40 b = 40 64 b = 40 64 63 b = 40 64 63 62 b = 40 64 63 62 61 b = 40 64 63 62 61 90 b = 40 64 63 62 61 90 89 b = 40 64 63 62 61 90 89 13 b = 40 64 63 62 61 90 89 13 12 b = 40 64 63 62 61 90 89 13 12 11

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

b = 56 b = 66 b = 66 65 b = 66 65 64 b = 66 65 64 63 b = 66 65 64 63 62 b = 66 65 64 63 62 61 b = 66 65 64 63 62 61 60 b = 66 65 64 63 62 61 60 59 b = 66 65 64 63 62 61 60 59 58 b = 66 65 64 63 62 61 60 59 58 57 b = 66 65 64 63 62 61 60 59 58 57 56

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

b = 2 b = 3 b = 3 4 b = 3 4 2

Suggested Problems

More from this Author1