Cody

# Problem 544. Create a square matrix of multiples

Solution 1160481

Submitted on 12 Apr 2017 by Jack Knoll
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 = 2; y_correct = [1,2;2,4]; assert(isequal(matrixMultiples(x),y_correct))

i = 1 j = 1 w = 1 j = 2 w = 1 2 j = 3 j = 1 i = 2 w = 1 2 2 0 j = 2 w = 1 2 2 4 j = 3 j = 1 i = 3

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

i = 1 j = 1 w = 1 j = 2 w = 1 2 j = 3 w = 1 2 3 j = 4 j = 1 i = 2 w = 1 2 3 2 0 0 j = 2 w = 1 2 3 2 4 0 j = 3 w = 1 2 3 2 4 6 j = 4 j = 1 i = 3 w = 1 2 3 2 4 6 3 0 0 j = 2 w = 1 2 3 2 4 6 3 6 0 j = 3 w = 1 2 3 2 4 6 3 6 9 j = 4 j = 1 i = 4

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

i = 1 j = 1 w = 1 j = 2 w = 1 2 j = 3 w = 1 2 3 j = 4 w = 1 2 3 4 j = 5 j = 1 i = 2 w = 1 2 3 4 2 0 0 0 j = 2 w = 1 2 3 4 2 4 0 0 j = 3 w = 1 2 3 4 2 4 6 0 j = 4 w = 1 2 3 4 2 4 6 8 j = 5 j = 1 i = 3 w = 1 2 3 4 2 4 6 8 3 0 0 0 j = 2 w = 1 2 3 4 2 4 6 8 3 6 0 0 j = 3 w = 1 2 3 4 2 4 6 8 3 6 9 0 j = 4 w = 1 2 3 4 2 4 6 8 3 6 9 12 j = 5 j = 1 i = 4 w = 1 2 3 4 2 4 6 8 3 6 9 12 4 0 0 0 j = 2 w = 1 2 3 4 2 4 6 8 3 6 9 12 4 8 0 0 j = 3 w = 1 2 3 4 2 4 6 8 3 6 9 12 4 8 12 0 j = 4 w = 1 2 3 4 2 4 6 8 3 6 9 12 4 8 12 16 j = 5 j = 1 i = 5