Day 3 :Intro to Conditional Statements.
Solution In Java 8:
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%2==1){
ans = "Weird";
}
else if (n>=2 && n<=5){
ans = "Not Weird";
}
else if (n>=6 && n<=20){
ans = "Weird";
}
else{
ans = "Not Weird";
}
System.out.println(ans);
}
}
Solution In Python 3:
import sys
N = int(input().strip())
if N%2!=0:
print("Weird")
elif N>=2 and N<=5:
print("Not Weird")
elif N>=6 and N<=20:
print("Weird")
else:
print("Not Weird")
Thank you for your post. This is excellent information. It is amazing and wonderful to visit your site.
ReplyDeleteDot Net Course in Chennai
Best Selenium Training Institute in Chennai
Software Testing Training Institute in Chennai
Core Java Training in Chennai
PHP Course in Chennai