euisblue
2438. 별 찍기 - 1

2438: 별 찍기 - 1

첫째 줄에는 별 1개, 둘째 줄에는 별 2개, N번째 줄에는 별 N개를 찍는 문제

C++

1#include <bits/stdc++.h> 2using namespace std; 3 4int main(void) { 5 ios::sync_with_stdio(0); 6 cin.tie(0); 7 int n; cin >> n; 8 9 for(int i=0;i <n; ++i) { 10 for(int j=0; j<i+1; ++j) 11 cout << "*"; 12 cout << endl; 13 } 14 15 return 0; 16}