Solution for Exercise CheckOddEven are given in two types without scanner and with scanner.
Solution for Exercise CheckOddEven with scanner
public class CheckOddEven {
public static void main(String[] args) {
int number = 49;
System.out.println("Your number is "+ number);
if (number%2<=0) {
System.out.println("The number "+ number+" is Even Number");
} else {
System.out.println("The Number "+ number+" is Odd Number" );
}
}
}
Solution for Exercise CheckOddEven with scanner
import java.util.Scanner;
public class CheckOddEven {
public static void main(String[] args) {
int n;
Scanner number=new Scanner(System.in);
System.out.println("Type your Number ");
n=number.nextInt();
if (n%2<=0) {
System.out.println("The number "+ n+" is Even Number");
} else {
System.out.println("The Number "+ n+" is Odd Number" );
}
}
}
No Comment to " Solution for Exercise CheckOddEven "