 # Write a program in Java to Check the Given Number is Even or Odd ### Deepak Kumar Mandal ( SDE at Cloudcraftz Solutions )

The following concept will test whether a number is Even or Odd by using Java Programming.

The following algorithm will help to check this condition.

• If the input number is divisible by 2 then it is a Even number.
• If the input number is not divisible by 2, then it is an Odd number.

## Work Flow

• Step 1. Start
• Step 2. Enter the number
• Step 3. check number is divisible by 2 or not.
• Step 4. if yes ,then it’s a even number
• Step 5. if no, then it’s an odd number

## Java Programme

```import java.util.Scanner;

public class EvenOdd { // Save your file name same as class name.

public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter a number : ");
int num = sc.nextInt(); // enter the value of num

// coditions for checking entered number is Even or Odd.
if (num % 2 == 0) {
System.out.println("Entered number is Even");
} else {
System.out.println("Entered number is Odd");
}

}

}

```
```Output:
Enter a number: 4
Entered number is Even

Enter a number: 3
Entered number is Odd``` 