Please enable JavaScript to use CodeHS

Want to receive Question of the Day updates? Subscribe Here

AP CSA Question of the Day Feb. 17, 2025

Reference
  1. Incorrect Correct No Answer was selected Invalid Answer

    What should be changed in the code snippet below to fix average(double[][] values) so that it returns the average value of all the values in values?

    public static double average(double[][] values) {
        double sum = 0;
        int count = 0;
        for (double x: values) {
            for (double y: x) {
                sum += y;
                count++;
            }
        }
        return sum/count;
    }
    Java