Mode Gelap

Recent in Fashion

Best Seller Books

Find Year

  • Problem Description

    Most years have 365 days. However, the time required for the Earth to orbit the Sun is actually slightly more than that. As a result, an extra day, February 29, is included in some years to correct for this difference. Such years are referred to as leap years.

    The rules for determining whether or not a year is a leap year follow:

    Any year that is divisible by 400 is a leap year.
    Of the remaining years, any year that is divisible by 100 is not a leap year.
    Of the remaining years, any year that is divisible by 4 is a leap year.
    All other years are not leap years.

    Write a program that reads a year from the user and displays a message indicating
    whether or not it is a leap year.
  • CODING ARENA
  • m=int(input())
    if(m%4)==0:
        if(m%100)==0:
            if(m%400)==0:
                print(m,"is a leap year")
            else:
                print(m,"is not a leap year")
        else:
            print(m,"is a leap year")
    else:
        print(m,"is not a leap year")
        

  • Test Case 1

    Input (stdin)
    2016

    Expected Output
    2016 is a leap year
  • Test Case 2

    Input (stdin)
    2001

    Expected Output
    2001 is not a leap year

Subscribe Our Newsletter

avatar
"By speaking behind my back, it means that you respect my existence enough not to act in front of my face."

Related Posts

0 Comment

Post a Comment

Article Top Ads

Parallax Ads

Article Center Ads

Article Bottom Ads