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 will the following code snippet output?
int[] values = {5, 12, 11, 3, 1, 112}; int sum = 0; for (int value : values) { if (value % 2 == 1) sum += value; } System.out.println("Sum: " + sum);
Sum: 0
Sum: 20
Sum: 144
Sum: 127
Sum: 17