티스토리 뷰

Programming/Baekjoon

[for문] 2741. N 찍기

Oziraper 2020. 7. 23. 15:07

* 1부터 N까지 출력하는 문제

자연수 N이 주어졌을 때, 1부터 N까지 한 줄에 하나씩 출력하는 프로그램을 작성하시오.

Language: C++

#include<iostream>
using namespace std; //std 네임스페이스 사용 
int main()
{
	cin.tie(NULL);
	ios_base::sync_with_stdio(false);

	int a;
	cin >> a;
	for (int i = 1; i <= a; i++) {
		cout << i << '\n';
	}
}

'Programming > Baekjoon' 카테고리의 다른 글

[for문] 11021. A+B - 7  (0) 2020.07.23
[for문] 2742. 기찍 N  (0) 2020.07.23
[for문] 15552. 빠른 A+B  (0) 2020.07.23
[for문] 8393. 합  (0) 2020.07.23
[for문] 10950. A+B - 3  (0) 2020.07.23
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/09   »
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
글 보관함