Skip to content

Instantly share code, notes, and snippets.

@hamidKMB
Created March 3, 2021 13:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hamidKMB/bcff886b14f87164be14a8e036c1a789 to your computer and use it in GitHub Desktop.
Save hamidKMB/bcff886b14f87164be14a8e036c1a789 to your computer and use it in GitHub Desktop.
Leap Year Checking
//Leap year
function leapYear(year){
if ( year % 4 == 0 ){
if( year % 100 == 0){
if( year % 400 == 0 ){
return "IS Leap Year";
} else {
return"NOT Leap Year";
}
}else{
return "IS Leap Year";
}
}else{
return "NOT Leap Year";
}
}
var a = prompt("Enter the year you want to know");
alert ( leapYear( a ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment