Start learning free

LESSON 84 OF 409 · CONDITIONAL STATEMENTS - CHALLENGES

Leap Year in C++

Practice

A leap year happens every four years, so it's a year that is perfectly divisible by four.

However, if the year is a multiple of 100 (1800, 1900, etc), the year must be divisible by 400 to be leap.

Write a function that determines if the year is a leap year or not.

Examples:

year = 2020 ➞ true

year = 2021 ➞ false

year = 1968 ➞ true

year = 1900 ➞ false

Video Solution:

STEP 1 OF 4
    Ctrl + Enter to check

    Leap Year in C++

    Keep going with C++About 340 step-by-step lessons, from your first line of code to coding interviews. Free to start.
    Start learning free