Skip to content

Instantly share code, notes, and snippets.

@mmisono
Created August 31, 2010 16:50
Show Gist options
  • Save mmisono/559327 to your computer and use it in GitHub Desktop.
Save mmisono/559327 to your computer and use it in GitHub Desktop.
max = 100
main = do fizzbuzz 1
fizzbuzz :: Int -> IO()
fizzbuzz n | n == max = putStrLn $ _fizzbuzz (n)
| otherwise = do putStrLn $ _fizzbuzz n
fizzbuzz (n+1)
where
_fizzbuzz :: Int -> String
_fizzbuzz x | x `mod` 15 == 0 = "FizzBuzz"
| x `mod` 5 == 0 = "Buzz"
| x `mod` 3 == 0 = "Fizz"
| otherwise = show x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment