Cody

Solution 1734408

Submitted on 23 Feb 2019 by Martin C.
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 = 15; sm_correct = 60; assert(isequal(sum3and5muls(n),sm_correct))

li = [] li = 3 li = 3 5 li = 3 5 6 li = 3 5 6 9 li = 3 5 6 9 10 li = 3 5 6 9 10 12 li = 3 5 6 9 10 12 15 sum_mult = 60

2   Pass
n = 18; sm_correct = 78; assert(isequal(sum3and5muls(n),sm_correct))

li = [] li = 3 li = 3 5 li = 3 5 6 li = 3 5 6 9 li = 3 5 6 9 10 li = 3 5 6 9 10 12 li = 3 5 6 9 10 12 15 li = 3 5 6 9 10 12 15 18 sum_mult = 78

3   Pass
n = (2^2)-1; sm_correct = 3; assert(isequal(sum3and5muls(n),sm_correct))

li = [] li = 3 sum_mult = 3

4   Pass
n = randi(25); sm_correct = sum(3:3:n)+sum(5:5:n)-sum(15:15:n); assert(isequal(sum3and5muls(n),sm_correct))

li = [] li = 3 li = 3 5 li = 3 5 6 li = 3 5 6 9 li = 3 5 6 9 10 li = 3 5 6 9 10 12 li = 3 5 6 9 10 12 15 li = 3 5 6 9 10 12 15 18 li = 3 5 6 9 10 12 15 18 20 li = 3 5 6 9 10 12 15 18 20 21 sum_mult = 119

Suggested Problems

More from this Author29