Check Even or Odd !

Program to check Even or odd in Java :

The number which is divisible by 2 is called Even number, otherwise Odd Number. Therefore, for number to be even Number %2=0 and for Odd numbers, Number%2 != 0 .

Following program checks whether the input number is an even number or odd :

Algorithm :

  1. Input number, n
  2. Check if n%2=0
    print “Even Number”
  3. Otherwise,
    print “Odd Number”.

Source Code :

Output :

Enter the Number : 26

26 is Even

Leave a Reply

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