Challenge: Leap Year

Lab C++ Intermediate 20 points

Read a year and print leap if it is a leap year, otherwise not leap.

A year is a leap year if it can be divided by 4, except years divisible by 100, unless they are also divisible by 400. (So 2024 and 2000 are leap years, 1900 is not.)

Input

One integer: the year.

Output

leap or not leap.

Example

Input

2024

Output

leap
Sample input available Sample output available
Editor
C++

Hints

"divisible by 4" means year % 4 == 0.

Leap if (divisible by 4 AND not by 100) OR divisible by 400.

Solution explanation

Combine the rules with && and ||. Brackets make the order clear.

Show solution
#include <iostream>
using namespace std;

int main() {
    int year;
    cin >> year;
    if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
        cout << "leap\n";
    } else {
        cout << "not leap\n";
    }
    return 0;
}
Output
Answer
HOME LABS COMMUNITY DASHBOARD