Created
April 13, 2017 02:33
-
-
Save dhanji/831f45903c8490c8dd321da9db9b5d02 to your computer and use it in GitHub Desktop.
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: http://wiki.c2.com/?FizzBuzzTest | |
fizzbuzz x | |
| fizz x && buzz x = "FizzBuzz" | |
| fizz x = "Fizz" | |
| buzz x = "Buzz" | |
| otherwise = "" | |
where | |
fizz n = (n `mod` 3) == 0 | |
buzz n = (n `mod` 5) == 0 | |
main = putStrLn $ show $ map fizzbuzz [1..100] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment