Last Updated: 09 July, 2022
On this page, we are going to learn how to check whether the number is even or odd through the simple Java Program. So, let's first understand what is even and odd numbers.
In mathematics, even numbers are those which when divided by 2 leaves no remainder or as 0 while Odd numbers are those numbers that when divided by 2 leave a remainder of 1.
For example:
Even Numbers: 2, 4, 6, 8, 10....
Odd Numbers: 3, 5, 7, 9....
The sum of two even numbers or two odd numbers is an even number whereas the sum of an even and an odd number is an odd number.
Output
8 is an Even Number.
15 is an Odd Number.
24 is an Even Number.
31 is an Odd Number.
Output 1:
Enter the number: 4
4 is an Even Number.
Output 2:
Enter the number: 7
7 is an Odd Number.
Output 1:
Enter the number: 180
180 is an Even Number
Output 2:
Enter the number: 221
221 is an Odd Number
That's all guys, hope this Java Program is helpful for you.
Happy Learning... 😀
feedback@javabytechie.com