FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 225   



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();
        in.close();

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

}

Output:

Please enter the number:
23
It's an odd number



On By


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News