Created
October 9, 2011 04:48
-
-
Save hajimehoshi/1273314 to your computer and use it in GitHub Desktop.
FizzBuzz in Haskell
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
main :: IO () | |
main = print $ map fizzBuzz [1..] | |
fizzBuzz :: Integer -> String | |
fizzBuzz n | |
| n `rem` 15 == 0 = "FizzBuzz" | |
| n `rem` 3 == 0 = "Fizz" | |
| n `rem` 5 == 0 = "Buzz" | |
| otherwise = show n |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please make shorter one.