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>) { | |
for(num in 1..40){ | |
val aho1 = num % 3 == 0 | |
val aho2 = num.toString().contains("3") | |
val result = if (aho1 || aho2){ | |
"アホ" | |
} else{ | |
num | |
} |
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")} |
NewerOlder