Skip to content

Instantly share code, notes, and snippets.

@chinnonsantos
Created February 20, 2021 23:37
Show Gist options
  • Save chinnonsantos/64350871fe4adb6d51745b32722323ac to your computer and use it in GitHub Desktop.
Save chinnonsantos/64350871fe4adb6d51745b32722323ac to your computer and use it in GitHub Desktop.
fun fizzbuzz(start: Int, end: Int): Unit {
for (k in start..end) {
if (k % 3 == 0 && k % 5 == 0)
println("Fizz Buzz")
else if (k % 3 == 0)
println("Fizz")
else if (k % 5 == 0)
println("Buzz")
else
println(k)
}
}
fun main() {
fizzbuzz(start = 1, end = 15)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment