X43: countEvens

Write a function in Java that takes an int array as its parameter and returns the number of even ints it contains. Note: the % "mod" operator computes the remainder, e.g. 5 % 2 is 1.

Examples:

countEvens({2, 1, 2, 3, 4}) -> 3
countEvens({2, 2, 0}) -> 3
countEvens({1, 3, 5}) -> 0

Your Answer:

Feedback

Your feedback will appear here when you check your answer.