Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //https://www.hackerrank.com/challenges/30-conditional-statements/
- 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 scan = new Scanner(System.in);
- int n = scan.nextInt();
- scan.close();
- String ans="";
- // if 'n' is NOT evenly divisible by 2 (i.e.: n is odd)
- if(n%2==1){
- ans = "Weird";
- }
- else{
- if(6 <= n && 20 >= n){
- ans = "Weird";
- }
- else{
- ans = "Not Weird";
- }
- }
- System.out.println(ans);
- }
- }
- /*
- If is odd, print Weird
- If is even and in the inclusive range of to , print Not Weird
- If is even and in the inclusive range of to , print Weird
- If is even and greater than , print Not Weird
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement