Kodewick
Start learning →
Starter←→0 / 50

Leap year

#004Starteryear % 400 == 04 min

The leap year rule: a year that divides by 4 but not by 100 is a leap year; a year that divides by 400 is also one. For example, 2024 and 2000 are leap years, 2023 and 1900 are not. Write is_leap(year): return true for a leap year, false if not.

Examples
is_leap(2024)→True
is_leap(2023)→False
is_leap(2000)→True
The functionbool is_leap(int year)
main.c
#include <stdbool.h>

bool is_leap(int year) {
    // your code here: return true or false using the leap year rule
    return false;
}
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.