logo image

Java program to find the given number is Even / Odd

Java program which takes a number as input and prints the given number is Even / Odd

import java.util.Scanner;

public class IfConditionPositiveOrNegative {

	public static void main(String[] args) {
		System.out.println("Please enter a number:");

		Scanner in = new Scanner(System.in);
		int i = in.nextInt();

		if (i < 0) {
			System.out.println("Given number is -ve");

		} else {
			System.out.println("Given number is +ve");



Please enter a number:
Given number is +ve