Just the sum of 1 to n
t = sum(1:n)
Test  Status  Code Input and Output 

1  Pass 
n = 1;
t = 1;
assert(isequal(triangle(n),t))
sum =
0
sum =
1

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

3  Pass 
n = 5;
t = 15;
assert(isequal(triangle(n),t))
sum =
0
sum =
1
sum =
3
sum =
6
sum =
10
sum =
15

4  Pass 
n = 30;
t = 465;
assert(isequal(triangle(n),t))
sum =
0
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

Back to basics 21  Matrix replicating
964 Solvers
395 Solvers
281 Solvers
262 Solvers
292 Solvers