how know if a leap year code example
Example 1: find leap year javascript
function isLeap(year) {
if (year % 4 === 0) {
if (year % 100 === 0){
if (year % 400 == 0){
return ("Leap year.");
} else {
return ("Not leap year.");
}
} else {
return ("Leap year.");
}
} else{
return ("Not leap year.");
}
}
Example 2: python check if year is a leap year
import calendar
print(calendar.isleap(1900))