Explore what CodeHS has to offer for districts, schools, and teachers.
Click on one of our programs below to get started coding in the sandbox!
View All
What does the following code snippet do?
int[] values = {4, 25, 13, 7, 62}; int mystery = 0; for (int i = 0; i < values.length; i++) { if (values[i] % 2 == 0) { mystery++; } } System.out.println(mystery);
Prints the sum of values in the array.
Prints the count of odd values in the array.
Prints the sum of odd values in the array.
Prints the count of even values in the array.
Prints the sum of even values in the array.