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
+ 0 comments JavaScript:
if (n % 2 !== 0 || (n % 2 === 0 && n >= 6 && n <= 20)) console.log('Weird') else console.log('Not Weird');
+ 1 comment import math import os import random import re import sys if __name__ == '__main__': n = int(input().strip()) if n % 2 != 0 : print("Weird") if n % 2 == 0: if n >= 2 and n <= 5: print("Not Weird") if n >= 6 and n <= 20: print("Weird") else: print("Not Weird")
+ 0 comments import math import os import random import re import sys
if name == 'main': N = int(input().strip()) if N%2==1 : print("Weird") if N%2==0 and N>=2 and N<=5 : print("Not Weird") if N%2==0 and N>=6 and N<=20 : print("Weird") if N>20 and N%2==0: print("Not Weird")
+ 1 comment hai, i used this method to solve it in python3.I am not able to spot
#!/bin/python3 import math import os import random import re import sys if __name__ == '__main__': N = int(input().strip()) if N/2 != 0: print("Weird") else: if N in range (2,6): print("Not Weird") elif N in range (6,21): print("Weird") elif N > 20: print("Not Weird")
`
+ 0 comments #include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; if(n & 1) cout << "Weird"; else { if(n >=2 && n <=5) cout << "Not Weird"; else if(n >=6 && n <= 20) cout << "Weird"; else if(n > 20) cout << "Not Weird"; } return 0; }
Load more conversations
Sort 1663 Discussions, By:
Please Login in order to post a comment