if-else -HackerRank solution 2020
if-else -HackerRank solution
In this challenge, we test your knowledge
of using if-else conditional statements to automate decision-making processes.
An if-else statement has the following logical flow:
import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;
public class Solution {
private static final Scanner scanner = new Scanner(System.in);
public static void main(String[] args) {
int N = scanner.nextInt();
scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?");
String ans="";
if(N%2==1 || (N>=6 && N <= 20)){
ans = "Weird";
}else{
ans = "Not Weird";
}
System.out.println(ans);
scanner.close();
}
}