Course of Raku / Addendum 🆕 / Flow and functions / Control flow and logic / Exercises

Leap years

Problem

A year is a leap year if it is divisible by 4, except that century years are leap only when divisible by 400. For the years 2000, 1900, 2024, and 2023, print whether each is a leap year or a common year.

Example

The program prints:

2000: leap
1900: common
2024: leap
2023: common

Solution

See the solution

Course navigation

Solution: Sign and parity   |   Solution: Leap years