Exercise · Conditions · lesson 5 of 6
Exercise: leap year
Write a function bool is_leap(int year) that returns true if the year is a leap year and false otherwise. A leap year is divisible by 4, but of the years divisible by 100, only those divisible by 400 are leap years.
is_leap(2024)→trueis_leap(1900)→falseis_leap(2000)→true
Constraints: year is from 1 to 9999.
Do not add extra #include lines unless the task says so explicitly.
Subscribe to take the course
The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.