netoops blog

Saturday, 24 August 2013

Even Odd

import java.util.Scanner;
 
class OddOrEven
{
   public static void main(String args[])
   {
      int x;
      System.out.println("Enter an integer to check if it is odd or even ");
      Scanner in = new Scanner(System.in);
      x = in.nextInt();
 
      if ( x % 2 == 0 )
         System.out.println("You entered an even number.");
      else
         System.out.println("You entered an odd number.");
   }
}
Output:

Tech Knowledege
SOCIALIZE IT →
FOLLOW US →
SHARE IT →

0 comments :

Post a Comment

 
Subscribe For Free Updates!

We'll not spam mate! We promise.

Become Our Fan on Social Sites!