Skip to content

Instantly share code, notes, and snippets.

@L8D
Forked from mmisono/fizzbuzz.hs
Last active August 29, 2015 13:56
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 L8D/8980440 to your computer and use it in GitHub Desktop.
Save L8D/8980440 to your computer and use it in GitHub Desktop.
main = putStr . unlines . map fizzbuzz $ [1..100]
divBy = ((== 0) .) . mod
fizzbuzz :: Int -> String
fizzbuzz x | x `divBy` 15 = "FizzBuzz"
| x `divBy` 5 = "Buzz"
| x `divBy` 3 = "Fizz"
| otherwise = show x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment