Java Program to Check Whether a Number is Even or Odd

In this tutorial you will learn about the Java Program to Check Whether a Number is Even or Odd and its application with practical example.

Java Program to Check Whether a Number is Even or Odd

In this tutorial, we will learn to create a Java program that will Check Whether a Number is Even or Odd using Java programming.

Prerequisites

Before starting with this tutorial we assume that you are best aware of the following Java programming topics:

  • Operators in Java Programming.
  • Basic Input and Output function in Java Programming.
  • Basic Java programming.
  • Conditional Statements in Java programming.
  • Arithmetic operations in Java Programming.

What is an even and odd number?

Even numbers are those numbers that are completely divisible by 2. which means the reminder should be zero. And odd numbers are those numbers that cannot be completely divisible by 2.

Algorithm:-

Program Description:-

In this program, First, we will take an input number from the user. And then we will use it in the program with conditional statements to find whether the number is even or odd. At last, we will print the output number as even or odd.

With the help of this program, we can Check Even and Odd numbers.

Program:-

Output:-

In the above program, we have first initialized the required variable.

  • no = it will hold the integer value.

Input number from the user.

Checking if even number.

Printing the even and odd number.

In this tutorial we have learn about the Java Program to Check Whether a Number is Even or Odd and its application with practical example. I hope you will like this tutorial.