Last active
August 29, 2015 14:23
-
-
Save wakwak3125/644445ed260461c53569 to your computer and use it in GitHub Desktop.
Simple FizzBuzz Kotlin.
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
fun main(args : Array<String>) { | |
val fzbz = ::FzBz | |
fzbz(1000) | |
} | |
// countの数までFizzBuzzする | |
fun FzBz(count : Int) { | |
for (i in 1..count) { | |
if (i % 3 == 0 && i % 5 == 0){println("FizzBuzz")} | |
else if (i % 3 == 0) {println("Fizz")} | |
else if (i % 5 == 0) {println("Buzz")} | |
else println(i) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment