Java Program to demonstrate if - else statement - HackerRank

// Program by Akash Tripathi (@proakash256)
import java.io.*;
public class if_else1
{    
    public static void main(String[] argsthrows IOException
    {
        BufferedReader sc = new BufferedReader
(new InputStreamReader(System.in));
        int n = Integer.parseInt(sc.readLine());
        sc.close();
        if(n % 2 == 0)
        {
            if(n >= 2 && n <= 5)
            {
                System.out.printf("Not Weird\n");
            }
            else if(n >= 6 && n <= 20)
            {
                System.out.printf("Weird\n");
            }
            else if(n > 20)
            {
                System.out.printf("Not Weird\n");
            }
        }
        else
        {
            System.out.printf("Weird\n");
        }
    }
}

Comments