Program:
public class Odd
{
public static void main(String[] args)
{
int x = 16;
int y = x % 2;
if (y == 0)
{
System.out.println("The given number is Even ");
}
else
{
System.out.println("The given number is odd ");
}
}
}
Compile:
javac Odd.java
java Odd
Output:
The given number is Even