Number of odd and even elements within matrix - MATLAB Cody - MATLAB Central

Problem 1580. Number of odd and even elements within matrix

Difficulty:Rate

Input(m) - any matrix with integers

Output(n) - n(1)=number of odd elements, n(2)=number of even elements

Example:

  • m=[1 2;3 4]; n=[2 2]
  • m=[1 1 2 3 3 4 5 5]; n=[6 2]

Solution Stats

55.18% Correct | 44.82% Incorrect
Last Solution submitted on Oct 22, 2025

Problem Comments

Solution Comments

Show comments
Join Cody Contest 2025 — Have Fun and Win Prizes!
...
We’re excited to invite you to Cody Contest 2025! 🎉 Pick a team,...

Problem Recent Solvers155

Suggested Problems

More from this Author9

Problem Tags

Community Treasure Hunt

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

Start Hunting!