Last active
December 21, 2015 01:48
-
-
Save maemre/6229804 to your computer and use it in GitHub Desktop.
A solution to infamous FizzBuzz test 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
module Main where | |
fb x | |
| x `divp` (3*5) = "FizzBuzz" | |
| x `divp` 3 = "Fizz" | |
| x `divp` 5 = "Buzz" | |
| otherwise = show x | |
where divp x y = (mod x y == 0) | |
main = | |
mapM (putStrLn . fb) [1..100] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment