Cody

# Problem 44397. Determine whether the input is odd, even, or neither.

Solution 1997197

Submitted on 31 Oct 2019
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; n_correct = 'odd'; assert(isequal(oddornot(x),n_correct))

n = 'odd' ans = 0

2   Pass
x = 12; n_correct = 'even'; assert(isequal(oddornot(x),n_correct))

n = 'even' ans = 0

3   Fail
x = 467.3; n_correct = 'error'; assert(isequal(oddornot(x),n_correct))

ans = 0.3000

Output argument "n" (and maybe others) not assigned during call to "oddornot". Error in Test3 (line 3) assert(isequal(oddornot(x),n_correct))

4   Pass
x = -911; n_correct = 'odd'; assert(isequal(oddornot(x),n_correct))

n = 'odd' ans = 0

5   Pass
x = 8230749726348; n_correct = 'even'; assert(isequal(oddornot(x),n_correct))

n = 'even' ans = 0

6   Fail
x = pi; n_correct = 'error'; assert(isequal(oddornot(x),n_correct))

ans = 0.1416

Output argument "n" (and maybe others) not assigned during call to "oddornot". Error in Test6 (line 3) assert(isequal(oddornot(x),n_correct))

7   Fail
x = 'a'; n_correct = 'error'; assert(isequal(oddornot(x),n_correct))

n = 'odd' ans = 0

Assertion failed.

8   Fail
x = 'donald'; n_correct = 'error'; assert(isequal(oddornot(x),n_correct))

ans = 0 0 0 0 0 0

Output argument "n" (and maybe others) not assigned during call to "oddornot". Error in Test8 (line 3) assert(isequal(oddornot(x),n_correct))