Cody

# Problem 5. Triangle Numbers

Solution 1888995

Submitted on 31 Jul 2019 by Jacques Tott-buswell
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 = 1; t = 1; assert(isequal(triangle(n),t))

tri_mat = 1 t = 1

2   Pass
n = 3; t = 6; assert(isequal(triangle(n),t))

tri_mat = 1 tri_mat = 1 2 tri_mat = 1 2 3 t = 6

3   Pass
n = 5; t = 15; assert(isequal(triangle(n),t))

tri_mat = 1 tri_mat = 1 2 tri_mat = 1 2 3 tri_mat = 1 2 3 4 tri_mat = 1 2 3 4 5 t = 15

4   Pass
n = 30; t = 465; assert(isequal(triangle(n),t))

tri_mat = 1 tri_mat = 1 2 tri_mat = 1 2 3 tri_mat = 1 2 3 4 tri_mat = 1 2 3 4 5 tri_mat = 1 2 3 4 5 6 tri_mat = 1 2 3 4 5 6 7 tri_mat = 1 2 3 4 5 6 7 8 tri_mat = 1 2 3 4 5 6 7 8 9 tri_mat = 1 2 3 4 5 6 7 8 9 10 tri_mat = 1 2 3 4 5 6 7 8 9 10 11 tri_mat = 1 2 3 4 5 6 7 8 9 10 11 12 tri_mat = 1 2 3 4 5 6 7 8 9 10 11 12 13 tri_mat = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 tri_mat = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 tri_mat = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 tri_mat = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 tri_mat = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 tri_mat = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 tri_mat = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 tri_mat = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 tri_mat = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 tri_mat = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 tri_mat = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 tri_mat = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 tri_mat = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 tri_mat = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 tri_mat = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 tri_mat = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 tri_mat = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 t = 465