# Check whether highest number is even or odd

In this section, you will learn how to check highest number between the two numbers and then determine whether it is odd or even.

Tutorials

# Check whether highest number is even or odd

In this section, you will learn how to check highest number between the two numbers and then determine whether it is odd or even.

### Check whether highest number is even or odd

In this section, you will learn how to check highest number between the two numbers and then determine whether it is odd or even. For this, we have taken two integer variables num1 and num2 and initialized to 40 and 37 respectively.Using the operators, we have determined the highest number.After getting the highest number, we have created a condition that if the highest number is totally divided by 2,then it is even, otherwise, it is odd.

Here is the code:

class CheckHighestNumber {
public static void main(String[] args) {
int num1 = 40;
int num2 = 37;
int highestNumber = 0;
if (num1 > num2) {
highestNumber = num1;
} else {
highestNumber = num2;
}
if (highestNumber % 2 == 0) {
System.out.println("Highest Number " + highestNumber + " is Even");
} else {
System.out.println("Highest Number " + highestNumber + " is Odd");
}
}
}

Output:

 Highest Number 40 is Even