Skip to content

Commit 11af24a

Browse files
authored
Add 직사각형-별찍기.js
1 parent 3fed46a commit 11af24a

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

level-1/직사각형-별찍기.js

+15-1
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,18 @@ process.stdin.on('data', data => {
3737
result += "\n";
3838
}
3939
console.log(result)
40-
});
40+
});
41+
42+
//정답 3 - yongchanson
43+
process.stdin.setEncoding("utf8");
44+
process.stdin.on("data", (data) => {
45+
const n = data.split(" ");
46+
const a = Number(n[0]),
47+
b = Number(n[1]);
48+
console.log(("*".repeat(a) + `\n`).repeat(b));
49+
});
50+
/*
51+
<풀이과정>
52+
repeat() 메서드는 문자열을 주어진 횟수만큼 반복해 붙인 새로운 문자열을 반환한다. ex) str.repeat(count);
53+
'*'.repeat(a) : *를 a만큼 반복한다.
54+
*/

0 commit comments

Comments
 (0)