Task

Given an integer,n , perform the following conditional actions:

If n is odd, print Weird
If n is even and in the inclusive range of 2 to 5 , print Not Weird
If n is even and in the inclusive range of 6 to 20, print Weird
If n is even and greater than 20, print Not Weird
Complete the stub code provided in your editor to print whether or not n is weird.

Input Format

A single line containing a positive integer,n .

Constraints
1<= n <= 100

Output Format
Print Weird if the number is weird; otherwise, print Not Weird.
in java

```java

import java.util.Scanner;

public class Solution {

public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
scanner.close();

if (n % 2 == 1) { // odd
System.out.println("Weird");
} else { // even
if (n >= 2 && n <= 5) {
System.out.println("Not Weird");
} else if (n >= 6 && n <= 20) {
System.out.println("Weird");
} else {
System.out.println("Not Weird");
}
}
}
}
```

Below is the Java code to solve the given task:

```
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();

if (n % 2 == 1 || (n >= 6 && n <= 20)) {
System.out.println("Weird");
} else {
System.out.println("Not Weird");
}

scanner.close();
}
}
```

Explanation:
1. We start by importing the `Scanner` class to read input from the user.
2. We declare a variable `n` to store the input value.
3. We use `scanner.nextInt()` to read the input integer from the user and store it in `n`.
4. We check the following conditions:
- If `n` is odd, i.e., `n % 2 == 1`, or if `n` is even and in the range 6 to 20, we print "Weird".
- If none of the above conditions are true, we print "Not Weird".
5. Finally, we close the scanner.
6. The output will be either "Weird" or "Not Weird" based on the value of `n`.

To solve this problem in Java, you can use if-else statements to check the conditionals and print the appropriate output. You can follow these steps:

1. Read the input from the user, which is a positive integer. You can use the `Scanner` class to get the input.
```java
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
```

2. Use if-else statements to check the conditionals and print the appropriate output.
```java
if (n % 2 != 0) {
System.out.println("Weird");
} else {
if (n >= 2 && n <= 5) {
System.out.println("Not Weird");
} else if (n >= 6 && n <= 20) {
System.out.println("Weird");
} else {
System.out.println("Not Weird");
}
}
```

3. Finally, close the `Scanner` to free up system resources.
```java
scanner.close();
```

Here's the complete code:
```java
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();

if (n % 2 != 0) {
System.out.println("Weird");
} else {
if (n >= 2 && n <= 5) {
System.out.println("Not Weird");
} else if (n >= 6 && n <= 20) {
System.out.println("Weird");
} else {
System.out.println("Not Weird");
}
}

scanner.close();
}
}
```

When you run this program, it will take the input from the user, check the conditionals, and print the appropriate output.