0
/ 50
Write a function in Java that takes an int
array as its parameter and returns the number of even int
s it contains. Note: the %
"mod"...
Write a function in Java that takes an int
array as
its parameter and returns the number of even int
s 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 feedback will appear here when you check your answer.