1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import java.util.*; public class Solution { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int num = Integer.parseInt(sc.nextLine()); switch ((1 <= num && num <= 5 ) ? 0 : (6 <= num && num <= 10) ? 1 : (11 <= num && num <= 15) ? 2 : 3) { case 0: System.out.println("I'm between one and five inclusive."); break; case 1: System.out.println("I'm between 6 and 10 inclusive."); break; case 2: System.out.println("I'm between 11 and 15 inclusive."); break; case 3: System.out.println("I'm not between."); break; } } } |
