आसान 0 हल किए गए 0% स्वीकृति

Leap Year

Check whether a year follows the Gregorian leap-year rule.

A year divisible by 4 is a leap year unless it is also divisible by 100. Years divisible by 400 are leap years despite that exception. Apply this arithmetic rule to every allowed input year.

Implement leap_year(year).

Input

year: The year to check.

Output

Return true for a leap year and false otherwise.

सीमाएँ

1 ≤ year ≤ 9999.

उदाहरण

उदाहरण 1
इनपुट:
year = 2024

अपेक्षित आउटपुट:
expected = True
इनपुट:
long long year = 2024;

अपेक्षित आउटपुट:
bool expected = true;
इनपुट:
long year = 2024;

अपेक्षित आउटपुट:
bool expected = true;

व्याख्या

2024 is divisible by 4 and not by 100.

उदाहरण 2
इनपुट:
year = 2100

अपेक्षित आउटपुट:
expected = False
इनपुट:
long long year = 2100;

अपेक्षित आउटपुट:
bool expected = false;
इनपुट:
long year = 2100;

अपेक्षित आउटपुट:
bool expected = false;

व्याख्या

2100 is divisible by 100 but not by 400, so the century exception applies.

संदर्भ

यह चुनौती CodeUtility के लिए अनुकूलित की गई है। ऊपर दिए गए स्टेटमेंट और सीमाओं का पालन करें।

दूसरों से सीखें

समुदाय समाधान

अभी तक कोई प्रकाशित समाधान नहीं। पहला साझा करने के लिए इस चुनौती को हल करें।