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.
  • HackerRank Home

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Hiring developers?
  1. Prepare
  2. Tutorials
  3. 30 Days of Code
  4. Day 3: Intro to Conditional Statements
  5. Discussions

Day 3: Intro to Conditional Statements

Problem
Submissions
Leaderboard
Discussions
Editorial
Tutorial

Sort 1663 Discussions, By:

recency

Please Login in order to post a comment

  • nadia_abowitz
    9 hours ago+ 0 comments

    JavaScript:

        if (n % 2 !== 0 || (n % 2 === 0 && n >= 6 && n <= 20)) console.log('Weird')
        else console.log('Not Weird');
    
    0|
    Permalink
  • sandeepsinghmsr1
    6 days ago+ 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|
    Permalink
  • ameensadiq597
    1 week ago+ 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")

    0|
    Permalink
  • nithya4434
    1 week ago+ 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|
    Permalink
  • trhsonngoc12
    1 week ago+ 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;
    }
    
    0|
    Permalink
Load more conversations

Need Help?


View tutorial
View editorial
View top submissions
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy