We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
hey.. when is run this code in hacker rank it failed for one Test case i.e '4' but it gives the correct output in my console..please tell if anyone can help
import java.util.*;
public class Solution {
private static final Scanner scanner = new Scanner(System.in);
public static void main(String[] args) {
int N = scanner.nextInt();
if(N%2==0){
if(N>20){
System.out.println("Not Weird");
}
if(N>=2 && N<=5){
System.out.println(" Not Weird");
}
if(N>=6 && N<=20){
System.out.println("Weird");
}
}
else{
System.out.println("Weird");
}
scanner.close();
}
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Java If-Else
You are viewing a single comment's thread. Return to all comments →
hey.. when is run this code in hacker rank it failed for one Test case i.e '4' but it gives the correct output in my console..please tell if anyone can help
import java.util.*; public class Solution {
}