HackerRank 30 Days of Code Solution Day 3: Conditional Statements

Featured image

In this tutorial, we will guide you through the process of solving the Day 3 Conditional Operators programming problem from HackerRank’s “30 Days of Code” challenge.

We will provide comprehensive code solutions in C++, Python, and JavaScript programming languages. With our help, you will gain a better understanding of the problem and learn how to approach and solve similar coding challenges.

Disclaimer: We encourage you to solve this challenge yourself before reading our tutorial. We have provided a detailed explanation of the problem and our solutions to help you check your work.

Conditional Statements

Conditional statements are a crucial component of programming that allows the execution of a block of code only if certain conditions are met. One type of conditional statement is the IF/Elif/Else statement, which checks if a condition is true and executes a specific block of code accordingly.

This enables developers to create more dynamic and flexible programs that can respond to varying circumstances in a sophisticated way. Conditional statements execute code if certain conditions are met. IF/Elif/Else are examples.

In this problem, we will print Weird/Not Weird based on the number provided by the user.


Based on the input number, n apply the following conditional statements:

It is a simple use case of conditional statements. We have to check the number and print the result based on the number.

Conditional Statement Solution Hackerrank Solution In Python

Conditional Statement Solution Hackerrank Solution In JavaScript(Js)


In this problem, we have to print Weird/Not Weird based on the input number. We have to use conditional statements to solve this problem.

Test Case

Tested on the Hackerrank platform for the following test case and passed all the test cases. Enclosed below is the screenshot of the test case.

Conditional Statement Solution Test Case