Two functions (to be sure) - MATLAB Cody - MATLAB Central

Problem 3004. Two functions (to be sure)

Difficulty:Rate

I want to compute the number of odd/even numbers in an array. But I want the results by two different functions.

Example:

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

So you must solve this problem by writing 2 functions.

But you can only submit one function at the time.

Do you think it's possible?

HINT: I always test odd_fcn first. So odd_fcn must create the other function...

Solution Stats

16.2% Correct | 83.8% Incorrect
Last Solution submitted on May 06, 2025

Problem Comments

Solution Comments

Show comments
AI Is Transforming Engineering Workflows
It’s an honor to deliver the keynote at MATLAB EXPO 2025. I'll...
0
MATLAB EXPO 2025 Registration is Now Open! November 12 – 13, 2025
Registration is now open for MathWorks annual virtual event MATLAB EXPO 2025...
0

Problem Recent Solvers18

Suggested Problems

More from this Author43

Problem Tags

Community Treasure Hunt

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

Start Hunting!