Challenge: Leap Year

Lab C Intermediate 20 points

Read a year and print leap or 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.

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.

Combine the rules with && and ||, and use brackets.

Solution explanation

The year is a leap year when it is divisible by 4 but not by 100, or when it is divisible by 400.

Show solution
#include <stdio.h>

int main() {
    int year;
    scanf("%d", &year);
    if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
        printf("leap\n");
    } else {
        printf("not leap\n");
    }
    return 0;
}
Output
Answer
HOME LABS COMMUNITY DASHBOARD