Created
April 1, 2017 09:13
-
-
Save Ahmah2009/79c7354a7876eae50a9fd22abe9984e0 to your computer and use it in GitHub Desktop.
is leap year algorithm in Erlang
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(leap). | |
-export([is_leap_year/1]). | |
is_leap_year(Year) when is_integer(Year), Year >= 0,Year rem 4 =:= 0, Year rem 100 > 0 -> | |
true; | |
is_leap_year(Year) when is_integer(Year), Year >= 0,Year rem 400 =:= 0 -> | |
true; | |
is_leap_year(_) -> false. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment