Check even or odd

Check even or odd


CHECK THE NUMBER IS EVEN OR ODD

import java.util.*;
class evenorodd
{
    public static void main()
    {
        int a;
        Scanner sc=new Scanner(System.in);
        System.out.print("Please enter a number : ");
        a=sc.nextInt();
        if(a%2==0)
        {
            System.out.println("The number you enter is even : ");
        }
        else
        {
            System.out.println("The number you enter is odd : ");
        }
    }
}

OUTPUT



Post a Comment

0 Comments