Created
November 27, 2010 18:35
-
-
Save tanob/718150 to your computer and use it in GitHub Desktop.
Prints the first 100 fizzbuzz numbers, implemented in Haskell.
This file contains hidden or 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
fizz n = n `mod` 3 == 0 | |
buzz n = n `mod` 5 == 0 | |
fizzbuzzFor n | fizz n && buzz n = "fizzbuzz" | |
| fizz n = "fizz" | |
| buzz n = "buzz" | |
| otherwise = show n | |
main = mapM_ (putStrLn . fizzbuzzFor) [1..100] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment