Created
August 27, 2013 08:52
-
-
Save sasaki-shigeo/6351242 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
-- FizzBuzz in Haskell | |
fizzBuzz n | n `mod` 15 == 0 = "FizzBuzz" | |
| n `mod` 3 == 0 = "Fizz" | |
| n `mod` 5 == 0 = "Buzz" | |
| otherwise = show n | |
main = do | |
putStr $ show $ map fizzBuzz [1..100] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment