Java program to find the given number is Even / Odd

Views: 169   

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(;
        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
On By