알고리즘 문제
[백준] 10995번 별 찍기 - 20
feelcoding
2020. 2. 20. 20:02
728x90
https://www.acmicpc.net/problem/10995
10995번: 별 찍기 - 20
예제를 보고 규칙을 유추한 뒤에 별을 찍어 보세요.
www.acmicpc.net
#include <iostream>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
int n;
cin >> n;
for (int i = 0; i < n; i++) {
if (i % 2 == 1) cout << ' ';
for (int j = 0; j < n; j++) {
cout << '*' << ' ';
}
cout << '\n';
}
return 0;
}
728x90