Hackerrank – Java Solution – Java If-Else

HackerRank Problem Solution

Problem Name – Java If-Else
Problem Link –  https://www.hackerrank.com/challenges/java-if-else/problem
Level – Introduction Challenges

Java Code

import java.util.Scanner;

public class Solution {
public static void main(String[] args) {
/* Read input */
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
scan.close();

/* Determine answer */
String ans = "";
if (n % 2 == 1) {
ans = "Weird";
} else {
if (n >= 6 && n <= 20) {
ans = "Weird";
} else {
ans = "Not Weird";
}
}

/* Print output */
System.out.println(ans);
}
}

Tags: HackerRank Online Judge Solution, HackerRank OJ Solution list, HackerRank Problems Solution, HackerRank solver, HackerRank all problem solution list, HackerRank solution in java, Hackerrank Java Solution, Hackerrank – Java Solution – Java If-Else

By Maniruzzaman Akash

Maniruzzaman Akash is a freelance web developer with most popular Laravel PHP frameork and Vue JS

Leave a Reply

Your email address will not be published. Required fields are marked *