Java Program to Check The Number is Even or Odd


-

-

Example:

Copied
import java.util.Scanner;

public class CheckEvenOdd
{
    public static void main(String args[])
    {
        int num;
        Scanner scan = new Scanner(System.in);
		
        System.out.println("Enter any Number: ");
        num = scan.nextInt();
		
        if(num%2 == 0)
        {
            System.out.println("It is Even Number");
        }
        else
        {
            System.out.println("It is Odd Number");
        }
    }
}

Output:

Enter any Number:
15
It is Odd Number