Advertisement
veronikaaa86

10. Invalid Number

Nov 13th, 2021
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. package advancedConditionalStatements;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P10InvalidNumber {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. int num = Integer.parseInt(scanner.nextLine());
  10.  
  11. boolean isValid = (num >= 100) && (num <= 200) || (num == 0); //150
  12.  
  13. if (!isValid) {
  14. System.out.println("invalid");
  15. }
  16. }
  17. }
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement