Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
%%
n = 1;
t = 1;
assert(isequal(triangle(n),t))
t =
0
t =
1
|
2 | Pass |
%%
n = 3;
t = 6;
assert(isequal(triangle(n),t))
t =
0
t =
1
t =
3
t =
6
|
3 | Pass |
%%
n = 5;
t = 15;
assert(isequal(triangle(n),t))
t =
0
t =
1
t =
3
t =
6
t =
10
t =
15
|
4 | Pass |
%%
n = 30;
t = 465;
assert(isequal(triangle(n),t))
t =
0
t =
1
t =
3
t =
6
t =
10
t =
15
t =
21
t =
28
t =
36
t =
45
t =
55
t =
66
t =
78
t =
91
t =
105
t =
120
t =
136
t =
153
t =
171
t =
190
t =
210
t =
231
t =
253
t =
276
t =
300
t =
325
t =
351
t =
378
t =
406
t =
435
t =
465
|
Determine if a Given Number is a Triangle Number
322 Solvers
Back to basics 20 - singleton dimensions
254 Solvers
283 Solvers
376 Solvers
Find my daddy long leg (No 's')
632 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!