StefanTobler

Lesson 14 Activity 1

Oct 1st, 2016
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.69 KB | None | 0 0
  1. /*
  2.  * Lesson 14 Coding Activity 1
  3.  * Test if an integer is not between 5 and 76 inclusive.
  4.  *
  5.  *     Sample Run 1
  6.  *         Enter a number:
  7.  *         7
  8.  *         False
  9.  *
  10.  *        
  11.  *      Sample Run 2
  12.  *         Enter a number:
  13.  *         1  
  14.  *         True
  15.  *
  16.  */
  17.  
  18.  
  19. import java.util.Scanner;
  20.  
  21. class Lesson_14_Activity_One {
  22.     public static void main(String[] args)
  23.      {
  24.       Scanner scan = new Scanner(System.in);
  25.       System.out.println("Enter a number:");
  26.       int x = scan.nextInt();
  27.       if (!(x >= 5 && x <= 76))
  28.       {
  29.         System.out.println("True");
  30.       }
  31.       else
  32.       {
  33.         System.out.println("False");
  34.       }
  35.      
  36.     }
  37. }
Add Comment
Please, Sign In to add comment