StefanTobler

Lesson 13 Activity 3

Sep 25th, 2016
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.76 KB | None | 0 0
  1. /*
  2.  * Lesson 13 Coding Activity 3
  3.  * Input two integers and print the largest. If they are equal print "EQUAL".
  4.  * You should be able to do this with only one if statement but you may use multiple else statements.
  5.  */
  6.  
  7.  
  8. import java.util.Scanner;
  9.  
  10. class Lesson_13_Activity_Three {
  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.        int y = scan.nextInt();
  19.        
  20.        if(x > y)
  21.        {  
  22.          System.out.println(x);
  23.        }
  24.        else if (x < y)
  25.        {
  26.          System.out.println(y);
  27.        }
  28.        else if (x == y)
  29.        {
  30.          System.out.println("EQUAL");
  31.        }
  32.     }
  33. }
Add Comment
Please, Sign In to add comment