Skip to content

Instantly share code, notes, and snippets.

@lbbedendo
Created December 18, 2019 12:55
Show Gist options
  • Save lbbedendo/3dd14c6024b485a1e4475cc6ff6db3b2 to your computer and use it in GitHub Desktop.
Save lbbedendo/3dd14c6024b485a1e4475cc6ff6db3b2 to your computer and use it in GitHub Desktop.
staircase
import java.util.stream.IntStream
fun stair(n: Int) {
IntStream.range(1, n).forEach {
println(" ".repeat(n - it) + "#".repeat(it))
}
}
fun main() {
print("Enter the stair size: ")
val n = readLine()!!
stair(n.toInt())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment