DEV Community

Anees Abdul
Anees Abdul

Posted on

Program to check whether the number is Odd or Even

public class Examples {



    public static void main(String[] args) {
        Scanner sc= new Scanner(System.in);
        System.out.println("Enter the number");
        int number=sc.nextInt();
        if(number%2==0) {
            System.out.println("The given number is Even");
        }
        else
        {
            System.out.println("The given number is Odd");
        }

}
}

Enter fullscreen mode Exit fullscreen mode

O/P:

Enter the number
21
The given number is Odd
Enter fullscreen mode Exit fullscreen mode

Top comments (0)