CJCoding With Joseph
15free / daySign inCreate account

Count Even Numbers

An array called nums has already been created for you with the values {10, 15, 20, 25, 30}. A variable called count has been initialized to 0.

Your task is to use the for loop to count how many even numbers are in the array.

A number is even if it is divisible by 2 with no remainder. You can check this using the modulus operator: nums[i] % 2 == 0. The % operator gives the remainder after division: if the remainder is 0, the number is even.

In this array, the even numbers are 10, 20, and 30, so the count should be 3.

Print the result in the exact format shown in Expected Output.

Expected Output:

Even count: 3

= newline. No newline after the last line.

Hints2 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 (cout, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.