문제 설명
이 문제에는 표준 입력으로 두 개의 정수 n과 m이 주어집니다.
별(*) 문자를 이용해 가로의 길이가 n, 세로의 길이가 m인 직사각형 형태를 출력해보세요.
문제 유형
- 입력 처리
- 반복문
코드 작성
#include <iostream>
using namespace std;
int main(void) {
int row;
int col;
cin >> col >> row;
for (int y = 0; y < row; y++)
{
for (int x = 0; x < col; x++)
{
cout << "*";
}
cout << endl;
}
return 0;
}'Algorithm > Practice' 카테고리의 다른 글
| [Algorithm] 이상한 문자 만들기 (1) | 2024.12.26 |
|---|---|
| [Algorithm] 최대공약수와 최소공배수 (0) | 2024.12.23 |
| [Algorithm] 행렬의 덧셈 (0) | 2024.12.20 |
| [Algorithm] 부족한 금액 계산하기 (0) | 2024.12.18 |
| [Algorithm] 문자열 내림차순으로 배치하기 (1) | 2024.12.17 |