0% found this document useful (0 votes)
47 views1 page

Hello

This Java program uses a Scanner to prompt the user to enter an integer, then uses the modulo (%) operator to check if the integer is even or odd. It prints the integer and a message indicating whether it is even or odd.

Uploaded by

umair riaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views1 page

Hello

This Java program uses a Scanner to prompt the user to enter an integer, then uses the modulo (%) operator to check if the integer is even or odd. It prints the integer and a message indicating whether it is even or odd.

Uploaded by

umair riaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

SOURCE CODE:

import java.util.Scanner;
public class EvenOdd {
public static void main(String[] args) {
Scanner reader = new Scanner(System.in);

System.out.print("Emter a Integer: ");


int num = reader.nextInt();

if (num % 2 == 0)
System.out.println(num + "is an even number");
else
System.out.println(num + "is an odd number");

}
}

OUTPUT:

You might also like