Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
18
Task/FizzBuzz/Haskell/fizzbuzz-2.hs
Normal file
18
Task/FizzBuzz/Haskell/fizzbuzz-2.hs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
fizzbuzz :: Int -> String
|
||||
fizzbuzz n =
|
||||
'\n' :
|
||||
if null (fizz ++ buzz)
|
||||
then show n
|
||||
else fizz ++ buzz
|
||||
where
|
||||
fizz =
|
||||
if mod n 3 == 0
|
||||
then "Fizz"
|
||||
else ""
|
||||
buzz =
|
||||
if mod n 5 == 0
|
||||
then "Buzz"
|
||||
else ""
|
||||
|
||||
main :: IO ()
|
||||
main = putStr $ concatMap fizzbuzz [1 .. 100]
|
||||
Loading…
Add table
Add a link
Reference in a new issue