borkins

03b. Even or Odd

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