← Unit 1 · all exercises
Saved in this browser only

Average of three

Return the average of three numbers: add them up and divide by three.

double average(double a, double b, double c)

Solution.java
Loading editor…
Results

Examples

  • average(1, 2, 3) → 2
  • average(10, 20, 30) → 20

There are also 3 hidden tests you can't see. Solve the problem, not the examples.