Cody

# Problem 3004. Two functions (to be sure)

Solution 2074480

Submitted on 30 Dec 2019 by Jonathan
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
x = 1; assert(isequal(odd_fcn(x),1)) assert(isequal(even_fcn(x),0))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In odd_fcn (line 2) In ScoringEngineTestPoint1 (line 2) In solutionTest (line 3)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In odd_fcn (line 3) In ScoringEngineTestPoint1 (line 2) In solutionTest (line 3)]

2   Pass
y = 2; assert(isequal(odd_fcn(y),0)) assert(isequal(even_fcn(y),1))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In odd_fcn (line 2) In ScoringEngineTestPoint2 (line 2) In solutionTest (line 5)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In odd_fcn (line 3) In ScoringEngineTestPoint2 (line 2) In solutionTest (line 5)]

3   Pass
x = [1 2]; assert(isequal(odd_fcn(x),1)) assert(isequal(even_fcn(x),1))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In odd_fcn (line 2) In ScoringEngineTestPoint3 (line 2) In solutionTest (line 7)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In odd_fcn (line 3) In ScoringEngineTestPoint3 (line 2) In solutionTest (line 7)]

4   Pass
x = 1:10; assert(isequal(odd_fcn(x),5)) assert(isequal(even_fcn(x),5))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In odd_fcn (line 2) In ScoringEngineTestPoint4 (line 2) In solutionTest (line 9)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In odd_fcn (line 3) In ScoringEngineTestPoint4 (line 2) In solutionTest (line 9)]

5   Pass
x = 1:100; assert(isequal(odd_fcn(x),50)) assert(isequal(even_fcn(x),50))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In odd_fcn (line 2) In ScoringEngineTestPoint5 (line 2) In solutionTest (line 11)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In odd_fcn (line 3) In ScoringEngineTestPoint5 (line 2) In solutionTest (line 11)]

6   Pass
x=(2:2:1000)'; assert(isequal(odd_fcn(x),0)) assert(isequal(even_fcn(x),500))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In odd_fcn (line 2) In ScoringEngineTestPoint6 (line 2) In solutionTest (line 13)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In odd_fcn (line 3) In ScoringEngineTestPoint6 (line 2) In solutionTest (line 13)]

7   Pass
x = [1:2:10000]; assert(isequal(odd_fcn(x),5000)) assert(isequal(even_fcn(x),0))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In odd_fcn (line 2) In ScoringEngineTestPoint7 (line 2) In solutionTest (line 15)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In odd_fcn (line 3) In ScoringEngineTestPoint7 (line 2) In solutionTest (line 15)]

8   Pass
x = [2 1:2:10000]; assert(isequal(odd_fcn(x),5000)) assert(isequal(even_fcn(x),1))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In odd_fcn (line 2) In ScoringEngineTestPoint8 (line 2) In solutionTest (line 17)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In odd_fcn (line 3) In ScoringEngineTestPoint8 (line 2) In solutionTest (line 17)]

9   Pass
x = [1 2 3;4 5 6;7 8 9]; assert(isequal(odd_fcn(x),5)) assert(isequal(even_fcn(x),4))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In odd_fcn (line 2) In ScoringEngineTestPoint9 (line 2) In solutionTest (line 19)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In odd_fcn (line 3) In ScoringEngineTestPoint9 (line 2) In solutionTest (line 19)]

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!