Is It In Range?
Easyjava
Read three integers x, lo and hi. Print true if lo <= x <= hi (inclusive), otherwise false.
Input: three integers separated by whitespace, in the order x lo hi (lo <= hi).
Output: one line — true or false.
Example 1
Input
5 1 10
Output
true
Example 2
Input
15 1 10
Output
false
- -1000000000 <= x, lo, hi <= 1000000000
- lo <= hi
Hint 1
Java has no lo <= x <= hi; write it as two comparisons joined with &&.
Hint 2
boolean inRange = x >= lo && x <= hi;
Chained comparisons are not allowed in Java, so combine two relational checks with &&: x is in range when x >= lo and x <= hi. Both boundary values count because the range is inclusive.