We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Day 3: Intro to Conditional Statements
Day 3: Intro to Conditional Statements
Sort by
recency
|
1795 Discussions
|
Please Login in order to post a comment
PYTHON
n=int(input()) if n%2!=0: print("Weird") elif n>=2 and n<=5: print("Not Weird") elif n>=6 and n<=20:
else: print("Not Weird")
n=int(input()) if n%2!=0: print("Weird") elif n>=2 and n<=5: print("Not Weird") elif n>=6 and n<=20:
else: print("Not Weird")
c#
Console.WriteLine((N % 2 != 0 || (N >= 6 && N <= 20))? "Weird" : "Not Weird");
print((lambda N: "Weird" if (N % 2 != 0) or (N >= 6 and N <= 20) else "Not Weird")(N))
For C Language
int main() { int N = parse_int(ltrim(rtrim(readline()))); if (N>=1 && N<=100) { if (N%2!=0) printf("Weird"); else { if ((N%2==0) && (N>=2 && N<=5)) printf("Not Weird"); else { if ((N%2==0) && (N>=6 && N<=20)) printf("Weird"); else { if ((N%2==0) && (N>20)) printf("Not Weird"); } } } } else printf("Not a positive integer."); return 0; }