It’s very easy to check Even or Odd Number. You take the number and divide it by 2, If the number is divisible by 2 it’s an even number else it is odd.

import java.util.Scanner;
class DecideOddEven
    public static void main(String args[])
    int InputNumber;
        System.out.println("Enter an Integer number:");
    //The input provided by user is stored in InputNumber
        Scanner input = new Scanner(;
        InputNumber = input.nextInt();
    /* If number is divisible by 2 then it's an even number
         * else odd number*/
    if (InputNumber % 2 == 0)
            System.out.println("Entered number is even");
        System.out.println("Entered number is odd");

Output 1:

Enter an Integer number:


Entered number is even

Output 2:

Enter an Integer number:


Entered number is odd

9 thoughts on “Even or Odd?

  1. I must say you have very interesting posts here. Thanks!!!!
    I am in high school and just started learning and your post are really helping me…

  2. My partner and I absolutely love your blog and find nearly all of your post’s to be precisely what I’m looking for. Again, awesome website!

  3. It is really a great and helpful piece of information. I¡¦m satisfied that you simply shared this helpful information with us. Please keep us informed like this. Thanks for sharing.

  4. I have recently started a web site, the info you offer on this site has helped me tremendously. Thanks for all of your time and work.

  5. I’m not that much of a internet reader to be honest but your blogs really nice, keep it up! I’ll go ahead and bookmark your site to come back later on. All the best

  6. Hi there! This is my first visit to your blog! Nice post… Are you planning to write on Object Oriented Programming soon?

Leave a Reply

Your email address will not be published. Required fields are marked *