Algorithm/C++ - 프로그래머스

프로그래머스 - 직사각형 별찍기 C++

ㅇㅇ잉 2021. 2. 15. 00:34

문제 그대로 for문으로 찍어주면 된다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>
 
using namespace std;
 
int main(void) {
    int a;
    int b;
    cin >> a >> b; 
    for(int i=0;i<b;i++){
        for(int j=0;j<a;j++){
            cout << "*";
        }
        cout << "\n";
    }
    return 0;
}
cs