728x90
반응형
직사각형 별찍기
문제 설명
이 문제에는 표준 입력으로 두 개의 정수 n과 m이 주어집니다.
별(*) 문자를 이용해 가로의 길이가 n, 세로의 길이가 m인 직사각형 형태를 출력해보세요.
* 제한사항
- n과 m은 각각 1000 이하인 자연수입니다.
* 제한사항
- n과 m은 각각 1000 이하인 자연수입니다.
process.stdin.setEncoding('utf8');
process.stdin.on('data', data => {
const n = data.split(" ");
const a = Number(n[0]), b = Number(n[1]);
const star = `${'*'.repeat(a)}\n`;
console.log(star.repeat(b));
});
다른 분 정답
process.stdin.setEncoding('utf8');
process.stdin.on('data', data => {
const n = data.split(" ");
const a = Number(n[0]), b = Number(n[1]);
const row = '*'.repeat(a)
for(let i =0; i < b; i++){
console.log(row)
}
});
728x90
'프로그래머스' 카테고리의 다른 글
프로그래머스 1단계 (1) | 2022.11.20 |
---|---|
프로그래머스 1단계 (2) | 2022.11.17 |
프로그래머스 1단계 (1) | 2022.11.13 |
프로그래머스 1단계 (1) | 2022.11.13 |
프로그래머스 1단계 (1) | 2022.11.13 |
댓글