logo image

Even OR Odd program in Java

Java program which takes a number as input and Prints its even number or odd number

import java.util.Scanner;

public class IfConditionEvenOrOdd {

	public static void main(String[] args) {
		System.out.println("Please enter the number:");
		Scanner in = new Scanner(System.in);
		int i = in.nextInt();

		if (i % 2 == 0) {
			System.out.println("Its an even number");
		} else {
			System.out.println("It's an odd number");



Please enter the number:
It's an odd number