Example : A Java program to check Odd or Even number.
import java.io.*;
import java.util.Scanner;
class Simple
{
public static void main(String args[])
{
int num;
System.out.println("Enter an Integer number: ");
Scanner Sc = new Scanner(System.in);
num = Sc.nextInt();
if ( num % 2 == 0 )
System.out.println("Entered number is Even");
else
System.out.println("Entered number is Odd");
}
}
0 Comments