Leap Year

Lab C++ Beginner 10 points

Read a year and print leap or common.

Input

One integer.

Output

One word.

Example

Input

2024

Output

leap
Sample input available Sample output available
Editor
C++

Hints

Store the condition in a bool, then use the conditional operator.

Solution explanation

Naming a condition with a bool variable makes code read like English.

Show solution
#include <iostream>
using namespace std;

int main() {
    int y;
    cin >> y;
    bool leap = (y % 4 == 0 && y % 100 != 0) || y % 400 == 0;
    cout << (leap ? "leap" : "common") << "\n";
    return 0;
}
Output
Answer
HOME LEARN COMMUNITY DASHBOARD