Advertisement
Spocoman

05. Number 100...200

Aug 25th, 2024
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.81 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Number100To200 {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         int num = Integer.parseInt(scanner.nextLine());
  7.  
  8.         if (num < 100) {
  9.             System.out.println("Less than 100");
  10.         } else if (num <= 200) {
  11.             System.out.println("Between 100 and 200");
  12.         } else {
  13.             System.out.println("Greater than 200");
  14.         }
  15.     }
  16. }
  17.  
  18. ИЛИ:
  19.  
  20. import java.util.Scanner;
  21.  
  22. public class Number100To200 {
  23.     public static void main(String[] args) {
  24.         Scanner scanner = new Scanner(System.in);
  25.         int num = Integer.parseInt(scanner.nextLine());
  26.  
  27.         System.out.println(num < 100 ? "Less than 100" : num > 200 ? "Greater than 200" : "Between 100 and 200");
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement