Skip to content

Instantly share code, notes, and snippets.

@Ahmah2009
Created April 1, 2017 09:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ahmah2009/79c7354a7876eae50a9fd22abe9984e0 to your computer and use it in GitHub Desktop.
Save Ahmah2009/79c7354a7876eae50a9fd22abe9984e0 to your computer and use it in GitHub Desktop.
is leap year algorithm in Erlang
-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