Practice
Array Zero Counter & Total
EASYArrays
Read 5 integer values into an array. Count how many are exactly 0, and calculate the sum of all non-zero values.
Input: 5 integers entered one by one. Output: Two lines: the count of zeros, then the total of non-zero numbers.
Example:
Input: 0
5
0
10
-2
Output: Zeros: 2
Total: 13
Premium is coming soon. All grading features are currently unlocked.
Sample Test Cases
Test 1: Mix of zeros, positives, negatives
Inputs: 0, 5, 0, 10, -2
Expected: Zeros: 2
Total: 13
Test 2: No zeros
Inputs: 1, 2, 3, 4, 5
Expected: Zeros: 0
Total: 15
Ctrl+Enter
Press Ctrl+Enter to run your code
or Ctrl+Shift+Enter to grade