Last active
August 29, 2015 14:07
-
-
Save jdiez17/3a697ca4cafd06bf4949 to your computer and use it in GitHub Desktop.
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
module Fizzbuzz where | |
import Data.List (unlines) | |
fizzbuzz :: Int -> String | |
fizzbuzz n = case (n `mod` 3, n `mod` 5) of | |
(0, 0) -> "FizzBuzz" | |
(0, _) -> "Fizz" | |
(_, 0) -> "Buzz" | |
(_, _) -> show n | |
showFizzbuzz :: Int -> IO () | |
showFizzbuzz n = do | |
let seq = [fizzbuzz i | i <- [1..n]] | |
putStrLn $ unlines seq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment