Cody

Solution 702468

Submitted on 17 Jul 2015 by Stephen
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))

z = 0 z = 1 n = 0 n = 1

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

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

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

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

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

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