const fs = require('fs');
const path = process.platform === 'linux' ? '/dev/stdin' : './input.txt';
const input = Number(fs.readFileSync(path).toString());
function solve(number) {
for (i = 1; i <= number; i++) {
console.log('*'.repeat(i));
}
}
solve(input);
๋ฌธ์ ์์ฒด๋ ์ด๋ ค์ด ๊ฒ ์๋๋ฐ, ํ์ด์ฌ๊ณผ ๋ค๋ฅด๊ฒ ๋ฌธ์์ด์ * ์ฐ์ฐ์ด ์๋๋ค๋ ์
๋ฌธ์์ด ๊ฐ์ฒด ํจ์์ธ repeat(number)๋ฅผ ํ์ฉํ๋ฉด ๊ทธ ์์ ์ซ์๋งํผ ๋ฐ๋ณต ์ถ๋ ฅ ๊ฐ๋ฅํ๋ค. :)
'๐ JavaScript > ๋ฐฑ์ค' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[JS] 10951 (0) | 2022.05.12 |
---|---|
[JS] 10871 (0) | 2022.05.11 |
[JS] 15552 (0) | 2022.05.09 |
[JS] 10950 (0) | 2022.05.08 |
[JS] ๋ฐฑ์ค ์ ๋ ฅ๋ฐ๊ธฐ (0) | 2022.05.08 |