Test | Status | Code Input and Output |
---|---|---|
1 | Fail |
n = 15;
sm_correct = 60;
assert(isequal(sum3and5muls(n),sm_correct))
v =
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
t =
1×15 logical array
0 0 1 0 0 1 0 0 1 0 0 1 0 0 1
f =
1×15 logical array
0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
o =
0 0 1 0 1 1 0 0 1 1 0 1 0 0 2
o =
0 0 1 0 1 1 0 0 1 1 0 1 0 0 1
|
2 | Fail |
n = 18;
sm_correct = 78;
assert(isequal(sum3and5muls(n),sm_correct))
v =
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
t =
1×18 logical array
0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1
f =
1×18 logical array
0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0
o =
0 0 1 0 1 1 0 0 1 1 0 1 0 0 2 0 0 1
o =
0 0 1 0 1 1 0 0 1 1 0 1 0 0 1 0 0 1
|
3 | Fail |
n = (2^2)-1;
sm_correct = 3;
assert(isequal(sum3and5muls(n),sm_correct))
v =
1 2 3
t =
1×3 logical array
0 0 1
f =
1×3 logical array
0 0 0
o =
0 0 1
o =
0 0 1
|
4 | Fail |
n = randi(25);
sm_correct = sum(3:3:n)+sum(5:5:n)-sum(15:15:n);
assert(isequal(sum3and5muls(n),sm_correct))
v =
1 2 3 4
t =
1×4 logical array
0 0 1 0
f =
1×4 logical array
0 0 0 0
o =
0 0 1 0
o =
0 0 1 0
|
Return a list sorted by number of occurrences
1504 Solvers
309 Solvers
746 Solvers
Getting the indices from a matrice
360 Solvers
376 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!