Input Format
A single line containing a positive integer, .
Output Format
Print Weird if the number is weird; otherwise, print Not Weird.    Conditional statement problem solution 30 days of code HackerRank

Problem solution in c++ programming language.

int main(){
    int n;
    cin >> n;
    if ((n & 1) || (6 <= n && n <= 20))
        cout << "Weird" << endl;
    else
        cout << "Not Weird" << endl;
    return 0;
}

Problem solution in Java programming language.

import java.util.*;

public class Solution {
   
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt(); 
        scan.close();

        System.out.println( ((n & 1) == 1 || (6 <= n && n <= 20)) ? "Weird" : "Not Weird");
    }
}

Second solution.

import java.util.*;

public class Solution {
    private static String weird = "Weird";
    private static String notWeird = "Not Weird";
    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;
        }
        // 'n' must be even; proceed if 'n' >= 2
        else if(n >= 2){ 
            if(n > 20){ 
                ans = notWeird;
            }
            else if(n >= 6){ 
                ans = weird;
            }
            else if(n >= 2){
                ans = notWeird;
            }
        }
        System.out.println(ans);
    }
}