- Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathJavaIfElse.java
More file actions
Latest commit
19 lines (17 loc) · 569 Bytes
/
Copy pathJavaIfElse.java
File metadata and controls
19 lines (17 loc) · 569 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
importjava.util.Scanner;
publicclassJavaIfElse {
publicstaticvoidmain(String[] args) {
Scannerscanner = newScanner(System.in);
intnumber = scanner.nextInt();
scanner.close();
if (number % 2 == 1) {
System.out.println("Weird");
} elseif (2 <= number && number <= 5) {
System.out.println("Not Weird");
} elseif (6 <= number && number <= 20) {
System.out.println("Weird");
} elseif (20 <= number) {
System.out.println("Not Weird");
}
}
}