← Unit 1 · all exercises
Saved in this browser only

The largest of three

Return the largest of three numbers. Math.max only takes two at a time, so one call has to go inside another.

int largest(int a, int b, int c)

Solution.java
Loading editor…
Results

Examples

  • largest(1, 5, 3) → 5
  • largest(9, 2, 4) → 9

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