Interval

Report a typo

Given an integer as an input, print True if its value falls within the interval (−15,12]∪(14,17)∪[19,+∞). Otherwise, print False (case sensitive).

Notes:

  • numbers denoted with a parenthesis () are exclusive;
  • numbers denoted with a square bracket [] are inclusive.

Sample Input 1:

20

Sample Output 1:

True

Sample Input 2:

-20

Sample Output 2:

False
Write a program in Java 17
import java.util.Scanner;

class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
// start coding here
}
}
___

Create a free account to access the full topic