CodeHub Menu
Home Exercise Practice About Download Portfolio Play Games NEW Privacy Policy Terms Contact
Login / Register

Even–Odd Program

JAVA November 18, 2025 5 views 0 likes
Even Odd Program in Java

Even Odd Program in Java


import java.util.Scanner;

public class EvenOdd {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        System.out.print("Enter a number: ");
        int num = sc.nextInt();

        if (num % 2 == 0) {
            System.out.println(num + " is EVEN");
        } else {
            System.out.println(num + " is ODD");
        }

        sc.close();
    }
}
5 views 0 likes
Total visits: 2,089 • Unique visitors: 1,285