Coders Packet

Centurial leap years using C++


This C++ code is to find out whether a given year is a leap year or not. A leap year can be centurial and non-centurial. The main goal is to clearly detect the leap year.

A centurial leap year is a year that is divisible by 100 e.g. 1900, 2000, 2100, etc. To find whether these years are leap years or not we have to check the divisibility by 100, 4, 400. This means that a year divisible by 4 is a leap year only until and unless it is a non-centurial year. In the case of the centurial year, this fact changes, and hence this code can be used to check both cases and easily find out the leap years regardless of the type of year it is.

Download Complete Code


No comments yet