Leap year or another is non leap year there are two types of year. Difference between leap year or non year is only one day. The leap year is 366 days and non leap year is 365 days. In 4 years one is leap year and other three year are non leap year. In leap year February month is 29 days and non leap year February month is 28 days.
Algorithm
Step:1 Start.Step:2 Read a year.
Step:3 If year %4 == 0 then this year is leap year otherwise not a leap year.
Step:4 Stop.
JavaScript code
<HTML>
<HEAD>
<TITLE>
</TITLE>
</HEAD>
<BODY>
<SCRIPT>
var year=prompt("Enter a year :");
if(year%4==0)
document.write("This year is leap year.");
else
document.write("This year is not a leap year.");
</SCRIPT>
</BODY>
</HTML>
Output : 1
Enter a year :2022
This year is not a leap year.
Output : 2
Enter a year :2024
This year is leap year.
0 Comments