← Unit 2 · all exercises
Saved in this browser only

Between two numbers

Return true when the value sits between low and high, counting the ends themselves. Java cannot write low <= value <= high; you need two comparisons joined with &&.

boolean inRange(int value, int low, int high)

Solution.java
Loading editor…
Results

Examples

  • inRange(5, 1, 10) → true
  • inRange(15, 1, 10) → false

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