Cody

Solution 1229299

Submitted on 11 Jul 2017 by Cam
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))

t = 0 t = 1 n = 0

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

t = 0 t = 3 n = 2 t = 5 n = 1 t = 6 n = 0

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

t = 0 t = 5 n = 4 t = 9 n = 3 t = 12 n = 2 t = 14 n = 1 t = 15 n = 0

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

t = 0 t = 30 n = 29 t = 59 n = 28 t = 87 n = 27 t = 114 n = 26 t = 140 n = 25 t = 165 n = 24 t = 189 n = 23 t = 212 n = 22 t = 234 n = 21 t = 255 n = 20 t = 275 n = 19 t = 294 n = 18 t = 312 n = 17 t = 329 n = 16 t = 345 n = 15 t = 360 n = 14 t = 374 n = 13 t = 387 n = 12 t = 399 n = 11 t = 410 n = 10 t = 420 n = 9 t = 429 n = 8 t = 437 n = 7 t = 444 n = 6 t = 450 n = 5 t = 455 n = 4 t = 459 n = 3 t = 462 n = 2 t = 464 n = 1 t = 465 n = 0