Skip to content

Instantly share code, notes, and snippets.

@keichi
Created June 29, 2011 15:18
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 keichi/1054062 to your computer and use it in GitHub Desktop.
Save keichi/1054062 to your computer and use it in GitHub Desktop.
FizzBuzz without using Mod, Mul, Div
import Control.Monad
fizz = concat $ repeat ["", "", "Fizz"]
buzz = concat $ repeat ["", "", "", "", "Buzz"]
fizzbuzz = zipWith (++) fizz buzz
combine num "" = show num
combine _ str = str
main = forM_ (take 100 $ zipWith combine [1 ..] fizzbuzz) putStrLn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment