Leap year: Difference between revisions
Content added Content deleted
(Added Java, fix "See Also" heading, TOC will appear automatically when it needs to) |
(Task template wasn't there before...) |
||
Line 1: | Line 1: | ||
Determine whether a given year is a leap year. |
{{task}}Determine whether a given year is a leap year. |
||
'''See Also''' |
'''See Also''' |
Revision as of 18:52, 20 July 2010
Leap year
You are encouraged to solve this task according to the task description, using any language you may know.
You are encouraged to solve this task according to the task description, using any language you may know.
Determine whether a given year is a leap year.
See Also
Java
<lang java>public static boolean isLeapYear(int year){
if(year % 100 == 0) return year % 400 == 0; return year % 4 == 0;
}</lang>
Python
<lang python>def is_leap_year(year):
if year % 100 == 0: return year % 400 == 0 return year % 4 == 0
</lang>