Know if a year is a leap year

Years divisible by 4 are leap years, but every 400 years 3 leap years must be removed. For this, those that are divided by 100 are not leap years, except those that are divided by 400, which are leap years.

In other words, all years divisible by 4 are leap years, excluding those that are divisible by 100, but not those that are divisible by 400.

In pseudocode it would be calculated like this:

IF ((year divisible by 4) AND ((year not divisible by 100) OR (year divisible by 400))) THEN is a leap ELSE is not a leap In ASP, the code would be as follows: if ((year mod 4)= 0) and ((ano mod 100)0 or (ano mod 400)=0) then … In Javascript and in languages ​​with similar syntax such as C, Java or PHP: if ((ano % 4 == 0) && ( (year % 100 != 0) || (year % 400 == 0)) …

See also  The problem of color in images for the web
Loading Facebook Comments ...
Loading Disqus Comments ...