Sum of Even Numbers in a Vector - MATLAB Cody - MATLAB Central

Problem 60823. Sum of Even Numbers in a Vector

Difficulty:Rate
Write a function that takes a vector x as input and returns the sum of all even numbers in x.
Input:
x = [1, 2, 3, 4, 5, 6]
Output:
y = 12

Solution Stats

90.91% Correct | 9.09% Incorrect
Last Solution submitted on Mar 24, 2025

Solution Comments

Show comments
Who Deserves Your Praise? Discover the New Contribution Widget!
...
We are excited to announce another update to our Discussions area: the...

Problem Recent Solvers9

Suggested Problems

More from this Author2

Problem Tags

Community Treasure Hunt

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

Start Hunting!
Go to top of page