Leap year

    Last updated November 30, 2026

    A year is a leap year when it is divisible by 400, or when it is divisible by 4 and not by 100. The chart asks those questions in that order. FlowSimp is completely free to use — no sign-up required.

    See the flowchart

    What does the flowchart look like?

    Ready to draw?

    No signup. Opens instantly in your browser.

    See the flowchart

    What is the matching code?

    Pseudocode

    read year
    if year is divisible by 400 then leap
    else if year is divisible by 100 then not leap
    else if year is divisible by 4 then leap
    else not leap

    Python

    def is_leap(year):
        if year % 400 == 0:
            return True
        if year % 100 == 0:
            return False
        return year % 4 == 0

    C

    int is_leap(int year) {
      if (year % 400 == 0) return 1;
      if (year % 100 == 0) return 0;
      return year % 4 == 0;
    }
    • 2000 is a leap year because 400 divides it. 1900 is not, because 100 divides it and 400 does not.
    • 2024 is a leap year. 2023 is not.