JAVA Program to Check Number is Even or Odd

JAVA Program to Check Number is Even or Odd:

import java.io.*;
class EvenOdd
{
 public static void main(String arg[])
 {
  int n=Integer.parseInt(arg[0]);
     System.out.println("Entered Number is "+n);
   if (n%2==0)
   System.out.println(n+ " is even");
   else
   System.out.println(n+" is odd");
   }
  }

OUTPUT:

Entered Number is 25
25 is odd

Entered Number is 14
14 is even

 

You may also like...

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.