void Algorithm
백준 문제 번호 : 2742 - 기찍 N
버그생성
2019. 9. 24. 09:18
문제
자연수 N이 주어졌을 때, N부터 1까지 한 줄에 하나씩 출력하는 프로그램을 작성하시오.
입력
첫째 줄에 100,000보다 작거나 같은 자연수 N이 주어진다.
출력
첫째 줄부터 N번째 줄 까지 차례대로 출력한다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
using System;
using System.Text;
class Program
{
static void Main(string[] args)
{
int a = int.Parse(Console.ReadLine());
StringBuilder aa = new StringBuilder();
for(int i = a; i >= 1; i--)
{
aa.Append(i+"\n");
}
Console.WriteLine(aa);
}
}
|
cs |
https://www.acmicpc.net/problem/2742
2742번: 기찍 N
자연수 N이 주어졌을 때, N부터 1까지 한 줄에 하나씩 출력하는 프로그램을 작성하시오.
www.acmicpc.net