CJCoding With Joseph
15free / daySign inCreate account

Count the Even Numbers

Counting is a classic array pattern: you keep a counter starting at 0 and increase it every time an element meets some condition. Here, loop through the array and count how many values are even. A number is even when the remainder of dividing it by 2 is zero, which you check with n % 2 == 0. Print 'Even count: ' followed by how many you found.

Expected Output:

Even count: 4

= newline. No newline after the last line.

Hints4 available
Topics:
Arrays
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (p, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.