Cody

# Problem 3004. Two functions (to be sure)

Solution 592054

Submitted on 5 Mar 2015 by Jean-Marie Sainthillier
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))

even_fcn = @(x)nnz(mod(x,2)==0)

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

even_fcn = @(x)nnz(mod(x,2)==0)

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

even_fcn = @(x)nnz(mod(x,2)==0)

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

even_fcn = @(x)nnz(mod(x,2)==0)

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

even_fcn = @(x)nnz(mod(x,2)==0)

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

even_fcn = @(x)nnz(mod(x,2)==0)

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

even_fcn = @(x)nnz(mod(x,2)==0)

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

even_fcn = @(x)nnz(mod(x,2)==0)

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

even_fcn = @(x)nnz(mod(x,2)==0)