Last active
September 17, 2018 11:10
-
-
Save Benjiko99/a2056e0a73e82047ed0d1b5b056a78e5 to your computer and use it in GitHub Desktop.
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
import java.util.Scanner | |
fun staircase(n: Int): Unit { | |
for (y in 1..n) { | |
var line = "" | |
for (x in 1..n) { | |
if (x <= n-y) | |
line += " " | |
else | |
line += "#" | |
} | |
System.out.println(line) | |
} | |
} | |
fun main(args: Array<String>) { | |
val scan = Scanner(System.`in`) | |
val n = scan.nextLine().trim().toInt() | |
staircase(n) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment