Cody

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

Solution 1997199

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   Fail
x = 1; n_correct = 'odd'; assert(isequal(oddornot(x),n_correct))

n = 'odd'

Matrix dimensions must agree. Error in oddornot (line 11) if class(x)=='char' Error in Test1 (line 3) assert(isequal(oddornot(x),n_correct))

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

n = 'even'

Matrix dimensions must agree. Error in oddornot (line 11) if class(x)=='char' Error in Test2 (line 3) assert(isequal(oddornot(x),n_correct))

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

n = 'error'

Matrix dimensions must agree. Error in oddornot (line 11) if class(x)=='char' Error in Test3 (line 3) assert(isequal(oddornot(x),n_correct))

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

n = 'odd'

Matrix dimensions must agree. Error in oddornot (line 11) if class(x)=='char' Error in Test4 (line 3) assert(isequal(oddornot(x),n_correct))

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

n = 'even'

Matrix dimensions must agree. Error in oddornot (line 11) if class(x)=='char' Error in Test5 (line 3) assert(isequal(oddornot(x),n_correct))

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

n = 'error'

Matrix dimensions must agree. Error in oddornot (line 11) if class(x)=='char' Error in Test6 (line 3) assert(isequal(oddornot(x),n_correct))

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

n = 'odd' n = 'error'

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

n = 'error'