Advertisement
apez1

Term 1: Lesson 14 - Coding Activity 2

Sep 25th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1.  
  2.  
  3.     import java.io.*;
  4. import static java.lang.System.*;
  5. import java.util.Scanner;
  6. import java.lang.Math;
  7.  
  8. public class Lesson_14_Activity_Two {
  9.       public static void main (String str []) throws IOException {
  10.    
  11.      Scanner scanner = new Scanner(System.in);
  12.  
  13.      int a;  
  14.      int b;  
  15.  
  16.      System.out.println("Enter 2 integers.");  
  17.      a = scanner.nextInt();
  18.      b = scanner.nextInt();
  19.  
  20.      if(a >= 0 && b >= 0 ) {
  21.       System.out.println("Both are positive or zero.");
  22.      }
  23.      else {
  24.       System.out.println("One or both are negative.");
  25.      }
  26.    
  27.      
  28.        
  29.       }
  30.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement