자연수 N이 주어졌을 때, 1부터 N까지 한 줄에 하나씩 출력하는 프로그램을 작성하시오.
첫째 줄에 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 = 1; i <= size; i++)
{
// :: Save Result
result[i - 1] = i.ToString();
}
// :: Print with "Wn" for Spped
Console.WriteLine(string.Join("\n", result));
}
}
}
'C#' 카테고리의 다른 글
백준 11021 : A+B - 7 (0) | 2020.11.30 |
---|---|
백준 2742 : 기찍 N (0) | 2020.11.29 |
백준 15552 : 빠른 A+B (0) | 2020.11.27 |
백준 2739 : 구구단 (0) | 2020.11.24 |
백준 2753 : 윤년 (0) | 2020.11.20 |