Advertisement
vp0415

Ex2

Oct 5th, 2014
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.40 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Ex2 {
  4.  
  5.     public static void main(String[] args) {
  6.         System.out.println("Enter an integer to check if it is odd or even ");
  7.         Scanner input = new Scanner(System.in);
  8.         int x = input.nextInt();
  9.      
  10.         if ( x % 2 == 0 )
  11.            System.out.println("You entered an even number.");
  12.         else
  13.            System.out.println("You entered an odd number.");
  14.     }
  15.  
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement