In this HackerRank Java If-Else problem we have given an integer input and if the integer is odd then print Weird, if the value is even and ranges from 2 to 5 then print Not Weird. and if range from 6 to 20 then print Weird and if input is even and greater than 20 the print Not Weird.

HackerRank Java If-Else problem solution

HackerRank Java If-Else problem solution

else{
            
   //Complete the code
    if(n>=2 && n<=5)
        ans="Not Weird";
    else if(n>=6 && n<=20)
       ans="Weird";
    else
        ans="Not Weird";

}