-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathif-else
50 lines (37 loc) · 1.26 KB
/
if-else
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
Using "if-else" you can perform decision making in Java. See the flowchart below (taken from wikipedia):
1446563087-4ec019a919-332px-If-Then-Else-diagram.svg
This problem will test your knowledge on "if-else" statements.
Given an integer NN as input, check the following:
If N is odd, print "Weird".
If N is even and, in between the range of 2 and 5(inclusive), print "Not Weird".
If N is even and, in between the range of 6 and 20(inclusive), print "Weird".
If N is even and N>20N>20, print "Not Weird".
*/
import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;
public class solution {
private static final Scanner scanner = new Scanner(System.in);
int N = 0;
public static void main(String[] args) {
int N = scanner.nextInt();
scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?");
scanner.close();
String ans="Weird";
if (N % 2 != 0) {
ans= "Weird";}
else {
ans= "Not Weird";
if ((2 <= N) && (N <= 5));{
ans= "Weird";}
if ((6 <= N) && (N <= 20));{
ans= "Not Weird";}
}
System.out.println(ans);
}
}