Java Program to check Even or Odd number.

Home / Uncategorized / Java Program to check Even or Odd number.

Java Program to check Even or Odd number.

import java.util.Scanner;
public class OddEvenNumber 
{
    public static void main(String arges[])
    {
        System.out.print("Enter any number:");
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        if(n%2==0)
        {
            System.out.println("This number is Even");
        }
        else
        {
            System.out.println("This number is Odd");
        }
    }
}

Output:

Enter any number:10
This number is Even.

Watch video of this program

Leave a Reply

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