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
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • 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 1632 Discussions, By:

recency

Please Login in order to post a comment

  • 63ashfaque
    3 days ago+ 0 comments

    Kotlin

    fun main(args: Array) { val N = readLine()!!.trim().toInt()

    if(N>=1 && N<=100)
    {
        if(N%2==0)
        {
            if(N in 2..5)
            { println("Not Weird")}
            else if(N in 6..20)
            {println("Weird")}
            else if(N>20)
            {println("Not Weird") }
        }
        else
        {   println("Weird")
        }
    }
    

    }

    0|
    Permalink
  • 2k20csbs22
    1 week ago+ 0 comments
    import java.util.Scanner;
    class Solution{
        public static void main(String [] args){
            Scanner sc = new Scanner(System.in);
            int a = sc.nextInt();
            if(a<6){
                if(a%2==0)
                    System.out.println("Not Weird");
                else
                    System.out.println("Weird");
            }
            else if(a<21)
                System.out.println("Weird");
            else if(a>20){
                if(a%2==0)
                    System.out.println("Not Weird");
                else 
                    System.out.println("Weird");
            }
        }
    }
    
    0|
    Permalink
  • [deleted] 2 weeks ago+ 0 comments

    Got stuck in finding the modulo operator, was trying with division instead and, well it took some time, long story short; still unupdated about name == main; here's the code:

    #!/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")
        elif (2 <= N | N <= 5):
            print("Not Weird")
        elif (6<= N | N <= 20):
            print("Weird")
        elif(N > 20):
            print("Not Weird")
    
    0|
    Permalink
  • paulius_padrost1
    2 weeks ago+ 0 comments

    Python

    if N % 2 != 0: print("Weird") elif N % 2 == 0 and N in range(6,21): print("Weird") else: print("Not Weird")

    0|
    Permalink
  • tanujas1309
    2 weeks ago+ 0 comments

    n=int(input()) if n%2!=0: print('Weird') else: if(n>=2 and n<5): print("Not Weird") elif n>=6 and n<=20: print("Weird") else: print("Not Weird")

    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