Cody

Solution 1007546

Submitted on 10 Oct 2016 by Cody Saunders
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))

x = 0 x = 1 n = 0 t = 1

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

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

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

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

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

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

Suggested Problems

More from this Author95