Notice
Recent Posts
Recent Comments
Link
«   2025/10   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Archives
Today
Total
관리 메뉴

코딩로그

[백준/BOJ/C++] 2440번 별 찍기 - 3 본문

YJ/C++

[백준/BOJ/C++] 2440번 별 찍기 - 3

Team DAON 2021. 10. 15. 16:09

[문제]

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

 

[입력]

첫째 줄에 N(1 ≤ N ≤ 100)이 주어진다.

 

[출력]

첫째 줄부터 N번째 줄까지 차례대로 별을 출력한다.

 

[Source Code]

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main() {
	int n;
	cin >> n;

	for(int i=0; i<n; i++) { 
            for(int j=i+1; j<=n; j++) {
                cout << "*";
            }        
            cout << "\n";        
        }
}

[결과 화면]