Java program -4: Write a java program which check Even or Odd number.
Solution:
import java.util.Scanner;
public class Check{
public static void main ( String [] args) {
int number ;
Scanner input = new Scanner(System.in);
System.out.print(" Enter e Integer Number :__);
number = input.nextInt();
if(number%2==0){
System.out.println("Entered number is Even");
}
else {
System.out.println(" Entered number is Odd ");
}
}
}
Input : 5
output : Entered number is Odd