Function for leap years

Write a function that tells if the given year is a leap year or not. To recall the rules about leap years, check the exercise problem://problemsjutge.org:problems/p1/jpetit/traspas-elemental.pbm.

Interface

C++
bool is_leap_year(int year);
C
int is_leap_year(int year);
Java
public static boolean isLeapYear(int year);
Python
is_leap_year(year)  # returns bool
is_leap_year(year: int) -> bool

Precondition

The parameter @year@ is between 1800 and 9999, both included.

Observation

You only need to submit the required procedure; your main program will be ignored.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T12:08:00.984Z

© Jutge.org, 2006–2026.
https://jutge.org