# Day 3: Intro to Conditional Statements In Java | 30 Days Of Code | HackerRank Programming Solutions

Hello Programmers/Coders, Today we are going to share solutions of Programming problems of 30 Days Of Code, HackerRank. At Each Problem with Successful submission with all Test Cases Passed, you will get an score or marks. And after solving maximum problems, you will be getting stars. This will highlight your profile to the recruiters.

In this post, you will find the solution for Day 3: Intro to Conditional Statements in Java-HackerRank Problem. We are providing the correct and tested solutions of coding problems present on HackerRank. If you are not able to solve any problem, then you can take help from our Blog/website.

`Use “Ctrl+F” To Find Any Questions Answer. & For Mobile User, You Just Need To Click On Three dots In Your Browser & You Will Get A “Find” Option There. Use These Option to Get Any Random Questions Answer.`

Link for the ProblemDay 3: Intro to Conditional Statements– Hacker Rank Solution

`Day 3: Intro to Conditional Statements – Hacker Rank Solution`

### Problem:

Objective
In this challenge, we learn about conditional statements. Check out the Tutorial tab for learning materials and an instructional video.

Given an integer, , perform the following conditional actions:

• If  is odd, print `Weird`
• If  is even and in the inclusive range of  to , print `Not Weird`
• If  is even and in the inclusive range of  to , print `Weird`
• If  is even and greater than , print `Not Weird`

Complete the stub code provided in your editor to print whether or not  is weird.

Input Format

A single line containing a positive integer, .

Constraints

Output Format

Print `Weird` if the number is weird; otherwise, print `Not Weird`.

Sample Input 0

```3
```

Sample Output 0

```Weird
```

Sample Input 1

```24
```

Sample Output 1

```Not Weird
```

Explanation

Sample Case 0:
is odd and odd numbers are weird, so we print `Weird`.

Sample Case 1:
and  is even, so it is not weird. Thus, we print `Not Weird`.

`Day 3: Intro to Conditional Statements – Hacker Rank Solution`
```import java.util.Scanner;

/**
* @author Techno-RJ
*
*/
public class Day3IntroToConditionalStatements {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
scan.close();
String ans = "";

// if 'n' is NOT evenly divisible by 2 (i.e.: n is odd)
if (n % 2 == 1) {
ans = "Weird";
} else {
if (n >= 6 && n
```
Scroll to Top