Count Even Numbers in an Array

Problem Description

Given an integer array, write a SystemVerilog function count_even that returns the number of even elements in the array.

An even number is any number divisible by 2.

Examples

Example 1
Input: {1,2,3,4}
Output: 2

Example 2
Input: {1,3,5}
Output: 0

SystemVerilog

Code Editor Access

Log in to write, run and submit your solution to this interview question. It's free.

Output

Output goes here...