Skip to content

Commit d91c89f

Browse files
simple staircase program
1 parent 068f4a3 commit d91c89f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

String-Questions/staircase-print.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
function staircase(n) {
2+
for (let i = 0; i < n; i++) {
3+
let str = ''
4+
for (let j = 0; j < (n - i) - 1; j++) {
5+
str = `${str} `
6+
}
7+
for (let k = 0; k <= i; k++) {
8+
str = `${str}#`
9+
}
10+
console.log(str)
11+
}
12+
return true
13+
}
14+
15+
console.log(staircase(5))

0 commit comments

Comments
 (0)