Created
June 27, 2012 16:37
-
-
Save niku/3005277 to your computer and use it in GitHub Desktop.
はじめてのHaskellプログラム - FizzBuzz
This file contains 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
fizzBuzz :: Int -> String | |
fizzBuzz n | |
| isFizzBuzz n = "FizzBuzz" | |
| isFizz n = "Fizz" | |
| isBuzz n = "Buzz" | |
| otherwise = show n | |
where isFizz n = (n `mod` 3 == 0) | |
isBuzz n = (n `mod` 5 == 0) | |
isFizzBuzz n = isFizz n && isBuzz n |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment