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
  • Apply
  • 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

    You are viewing a single comment's thread. Return to all comments →

  • trhsonngoc12
    4 months 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
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy