자연수 N이 주어졌을 때, N부터 1까지 한 줄에 하나씩 출력하는 프로그램을 작성하시오.
첫째 줄에 100,000보다 작거나 같은 자연수 N이 주어진다.
첫째 줄부터 N번째 줄 까지 차례대로 출력한다.
:: 성공
: 개선점 : 없음
using System;
namespace for01
{
class Program
{
static void Main(string[] args)
{
// :: Input size and Parse
int size = Int32.Parse(Console.ReadLine());
// :: result Array
string[] result = new string[size];
// :: Loop with size
for(int i = 0; i < size; i++)
{
// :: Save Result
result[i] = (size - i).ToString();
}
// :: Print with "Wn" for Spped
Console.WriteLine(string.Join("\n", result));
}
}
}
'C#' 카테고리의 다른 글
백준 2439 : 별 찍기 - 2 (0) | 2020.12.03 |
---|---|
백준 11021 : A+B - 7 (0) | 2020.11.30 |
백준 2741 : N 찍기 (0) | 2020.11.28 |
백준 15552 : 빠른 A+B (0) | 2020.11.27 |
백준 2739 : 구구단 (0) | 2020.11.24 |