Cody

Solution 1869928

Submitted on 10 Jul 2019 by XuanRong Pan
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))

sum = 1

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

sum = 1 sum = 3 sum = 6

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

sum = 1 sum = 3 sum = 6 sum = 10 sum = 15

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

sum = 1 sum = 3 sum = 6 sum = 10 sum = 15 sum = 21 sum = 28 sum = 36 sum = 45 sum = 55 sum = 66 sum = 78 sum = 91 sum = 105 sum = 120 sum = 136 sum = 153 sum = 171 sum = 190 sum = 210 sum = 231 sum = 253 sum = 276 sum = 300 sum = 325 sum = 351 sum = 378 sum = 406 sum = 435 sum = 465

Suggested Problems

More from this Author95