Advertisement
veronikaaa86

05. Small Shop

May 21st, 2022
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. package nestedConditionalStatements;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P06NumberInRange {
  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 <= 100 && num != 0;
  12.  
  13. if (isValid) {
  14. System.out.println("Yes");
  15. } else {
  16. System.out.println("No");
  17. }
  18. }
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement