Created
November 27, 2012 22:06
-
-
Save matthandlersux/4157469 to your computer and use it in GitHub Desktop.
fizzbuzz 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(fizzBuzz). | |
-export([fizzBuzz/0]). | |
fizzBuzz() -> | |
fizzBuzz(1,3,5). | |
fizzBuzz(100, _, _) -> | |
io:format("buzz~n"); | |
fizzBuzz(Count, Count, Count) -> | |
io:format("fizzbuzz~n"), | |
fizzBuzz(Count + 1, Count + 3, Count + 5); | |
fizzBuzz(Count, Threes, Count) -> | |
io:format("buzz~n"), | |
fizzBuzz(Count + 1, Threes, Count + 5); | |
fizzBuzz(Count, Count, Fives) -> | |
io:format("fizz~n"), | |
fizzBuzz(Count + 1, Count + 3, Fives); | |
fizzBuzz(Count, Threes, Fives) -> | |
io:format("~w~n",[Count]), | |
fizzBuzz(Count + 1, Threes, Fives). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment