-
Notifications
You must be signed in to change notification settings - Fork 0
/
nested_if_else.java
36 lines (32 loc) · 1.05 KB
/
nested_if_else.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import java.util.Scanner;
public class nested_if_else {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter the integer: ");
Integer x = input.nextInt();
if(x>100){
if(x%2 == 0){
System.out.println("The number is greater than 100 & is an even number");
}
else{
System.out.println("The number is greater than 100 & is an odd number");
}
}
if(x == 100){
if(x%2 == 0){
System.out.println("The number is equal to 100 & is an even number");
}
else{
System.out.println("The number is equal to 100 & is an odd number");
}
}
else{
if(x%2 == 0){
System.out.println("The number is less than 100 & is an even number");
}
else{
System.out.println("The number is less than 100 & is an odd number");
}
}
}
}