Exercise · Operators · lesson 8 of 9
Exercise: leap year
Write a function func isLeap(year int) bool that returns true if the year is a leap year. A year is a leap year when it is divisible by 4 but not by 100. Years divisible by 400 are the exception: they are leap years.
isLeap(2024)→trueisLeap(1900)→falseisLeap(2000)→true
Constraints: year is an integer from 1 to 9999.
Do not add extra imports 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.