Created
May 2, 2018 17:31
-
-
Save abusoid/62d6c5a5b3f60d39c03510a7bd6502e8 to your computer and use it in GitHub Desktop.
HackerRank Java If-Else
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.util.*; | |
import java.text.*; | |
import java.math.*; | |
import java.util.regex.*; | |
public class Solution { | |
public static void main(String[] args) { | |
Scanner sc=new Scanner(System.in); | |
int n=sc.nextInt(); | |
String ans=""; | |
if(n%2==1){ | |
ans = "Weird"; | |
} | |
else{ | |
if (n >= 2 && n <= 5){ | |
ans = "Not Weird"; | |
}else{ | |
if (n >= 6 && n <=20){ | |
ans = "Weird"; | |
}else{ | |
if (n >= 20){ | |
ans = "Not Weird"; | |
} | |
} | |
} | |
} | |
System.out.println(ans); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment