직사각형 별찍기
https://programmers.co.kr/learn/courses/30/lessons/12969
코딩테스트 연습 - 직사각형 별찍기
이 문제에는 표준 입력으로 두 개의 정수 n과 m이 주어집니다. 별(*) 문자를 이용해 가로의 길이가 n, 세로의 길이가 m인 직사각형 형태를 출력해보세요. 제한 조건 n과 m은 각각 1000 이하인 자연수
programmers.co.kr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main(void) { | |
int a; | |
int b; | |
cin >> a >> b; | |
for (int row = 0; row < b; ++row) | |
{ | |
for(int col = 0; col < a; ++col) | |
{ | |
cout << "*"; | |
} | |
cout << endl; | |
} | |
return 0; | |
} |
반응형
'자료구조 와 알고리즘 > 프로그래머스' 카테고리의 다른 글
평균 구하기 (0) | 2022.05.08 |
---|---|
하샤드 수 (0) | 2022.05.08 |
핸드폰 번호 가리기 (0) | 2022.05.08 |
행렬의 덧셈 (0) | 2022.05.08 |
x만큼 간격이 있는 n개의 숫자 (0) | 2022.05.08 |