Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

fizzbuzz.hs

Name: Anonymous 2012-09-24 0:24

module Main where

main :: IO ()
main = do putStrLn "FizzBuzz Upto: "
      n <- getLine
      printAll $ map fizzbuzz [1..(read n :: Int)]
      where
      printAll [] = getLine >> return ()
      printAll (x:xs) = putStrLn x >> printAll xs
      fizzbuzz n
        | mod n 15 == 0 = "FizzBuzz"
        | mod n 5  == 0 = "Buzz"
        | mod n 3  == 0 = "Fizz"
        | otherwise    = show n

Name: Anonymous 2012-09-24 1:16

Once again proving that C can do everything more elegantly and efficient than every other language.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List