By Definition, "A leap year is a year containing one extra day in order to keep the calendar year synchronized with the astronomical or seasonal year."
In a Leap Year, February month has 29 days.
If you are looking for the Algorithm or Source Code to find leap year, here it is.
if year modulo 4 is 0
then
if year modulo 100 is 0
then
if year modulo 400 is 0
then
is_leap_year
else
not_leap_year
else is_leap_year
else not_leap_year
Enter the year you wish to check
function LeapYear()
{
x =0;
x= document.getElementById("txtin").value;
if(x=="")
{
document.getElementById("txtout").value="Year can't be blank";
}
else if(isNaN(x))
{
document.getElementById("txtout").value="Enter a valid Year";
}
else
{
if(x%4==0)
{
if(x%100==0)
{
if(x%400==0)
document.getElementById("txtout").value="Leap Year";
else
document.getElementById("txtout").value="Not Leap Year";
}
else
document.getElementById("txtout").value="Leap Year";
}
else
document.getElementById("txtout").value="Not Leap Year";
}
}
</script>
Enter the year you wish to check
<input id="txtin" type="text" /><button onclick="LeapYear()" type="button">Check Leap Year</button>
<input id="txtout" size="40/" type="text" />
You can use the same logic and create your own calculator in C# or VB.Net or any other Programming Language.
Let me know if you face any difficulties in implementing your own calculator.
In a Leap Year, February month has 29 days.
If you are looking for the Algorithm or Source Code to find leap year, here it is.
Leap Year Algorithm:
Here is the Pseudo code to determine whether a year is a leap year or not.if year modulo 4 is 0
then
if year modulo 100 is 0
then
if year modulo 400 is 0
then
is_leap_year
else
not_leap_year
else is_leap_year
else not_leap_year
Leap Year Calculator:
Enter the year you wish to check
Leap Year Calculator Source Code in JavaScript:
<script type="text/javascript">function LeapYear()
{
x =0;
x= document.getElementById("txtin").value;
if(x=="")
{
document.getElementById("txtout").value="Year can't be blank";
}
else if(isNaN(x))
{
document.getElementById("txtout").value="Enter a valid Year";
}
else
{
if(x%4==0)
{
if(x%100==0)
{
if(x%400==0)
document.getElementById("txtout").value="Leap Year";
else
document.getElementById("txtout").value="Not Leap Year";
}
else
document.getElementById("txtout").value="Leap Year";
}
else
document.getElementById("txtout").value="Not Leap Year";
}
}
</script>
Enter the year you wish to check
<input id="txtin" type="text" /><button onclick="LeapYear()" type="button">Check Leap Year</button>
<input id="txtout" size="40/" type="text" />
You can use the same logic and create your own calculator in C# or VB.Net or any other Programming Language.
Let me know if you face any difficulties in implementing your own calculator.