AnswerBox
Java

For-Each with Array

Description:
Use for-each to calculate average score.
Java Code
public class ForEachDemo {
    public static void main(String[] args) {
        int[] scores = {85, 90, 78, 92, 88};
        int total = 0;
        for (int s : scores) total += s;
        System.out.printf("Average: %.1f%n", (double)total/scores.length);
    }
}
Expected Output
Average: 86.6