borkins

04b. Greater Number

Mar 23rd, 2017
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.45 KB | None | 0 0
  1. /*
  2.  * Simple Conditions
  3.  */
  4. import java.util.Scanner;
  5.  
  6. public class _04b_GreaterNumber
  7. {
  8.     public static void main(String[] args)
  9.     {
  10.         Scanner scan = new Scanner(System.in);
  11.  
  12.         int a = Integer.parseInt(scan.nextLine());
  13.         int b = Integer.parseInt(scan.nextLine());
  14.        
  15.         // Using ternary operator (?:) to print the result
  16.         // result = Condition ? Statement1 : Statement2;
  17.         System.out.println((a > b) ? a : b);
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment