Cody

Solution 2125342

Submitted on 11 Feb 2020 by Asif Newaz
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
n = 3; y_correct = [15 15 15 15]; %row sum, col sum, main diag sum, other diag sum [a b c d] = MagicSquare(n); assert(isequal([a b c d],y_correct))

row1Sum = 15 col1Sum = 15 diag1Sum = 15 adiagSum = 15

2   Pass
n = 5; y_correct = [65 65 65 65]; %row sum, col sum, main diag sum, other diag sum [a b c d] = MagicSquare(n); assert(isequal([a b c d],y_correct))

row1Sum = 65 col1Sum = 65 diag1Sum = 65 adiagSum = 65

3   Pass
n = 9; y_correct = [369 369 369 369]; %row sum, col sum, main diag sum, other diag sum [a b c d] = MagicSquare(n); assert(isequal([a b c d],y_correct))

row1Sum = 369 col1Sum = 369 diag1Sum = 369 adiagSum = 369

4   Pass
n = 15; y_correct = [1695 1695 1695 1695]; %row sum, col sum, main diag sum, other diag sum [a b c d] = MagicSquare(n); assert(isequal([a b c d],y_correct))

row1Sum = 1695 col1Sum = 1695 diag1Sum = 1695 adiagSum = 1695