StefanTobler

Lesson 13 Activity 1

Sep 25th, 2016
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1. /*
  2.  * Lesson 13 Coding Activity 1
  3.  * Take input of an integer number from the keyboard
  4.  * and print "Positive" if it's positive or zero, and print "Negative" otherwise.
  5.  */
  6.  
  7.  
  8. import java.util.Scanner;
  9.  
  10. class Lesson_13_Activity_One {
  11.     public static void main(String[] args)
  12.      {
  13.        Scanner scan = new Scanner(System.in);
  14.        
  15.        System.out.println("Please enter a interger:");
  16.        
  17.        int x = scan.nextInt();
  18.        
  19.        if(x >=0)
  20.        {  
  21.          System.out.println("Positive");
  22.        }
  23.        else
  24.        {
  25.          System.out.println("Negative");
  26.        }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment