JavaScript :- Leap Year (if...else)
This is JavaScript Practical :- Leap Year (if...else).
Script written in small letter because JavaScript Case Sensitive.
Script:-
<html>
<head>
<title>leapYear</title></head>
<body>
<script type="text/javascript">
// This is a Leap Year with if else.
var year;
year = parseInt(prompt("year"));
if ( (0 == year % 4) && (0 != year % 100) || (0 == year % 400) )
{
document.write(year + " is a leap year");
}
else
{
document.write(year + " is not a leap year");
}
</script>
</body>
</html>
Save the File .html
Output:-
If you have any doubts mention on the Comment Box.
Please follow the my Blog, Share and Comment.
Comments
Post a Comment