first commit with existing project files
This commit is contained in:
19
algo_js/escaliers.js
Normal file
19
algo_js/escaliers.js
Normal file
@@ -0,0 +1,19 @@
|
||||
const prompt = require('prompt-sync')();
|
||||
|
||||
// Escalier
|
||||
|
||||
const hash = "#"
|
||||
const space = " "
|
||||
|
||||
let nombre = prompt("Entrez le nombre de marches : ")
|
||||
|
||||
for (let i = 1; i <= nombre; i++) {
|
||||
let escalier = ""
|
||||
|
||||
for (let j = 1; j <= nombre; j++) {
|
||||
if (j <= nombre - i) escalier += space
|
||||
else escalier += hash
|
||||
}
|
||||
|
||||
console.log(escalier)
|
||||
}
|
||||
Reference in New Issue
Block a user