하루 한 접시

[백준] 10817번: 세 수[C#]

NaZZU 2024. 3. 21. 23:39

정수 세개가 한 줄에 입력되고, 그걸 정렬해서 2번째 원소를 출력해주면 되는 간단한 문제이다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
using System.IO;
using System.Text;
using System.Linq;
using System.Reflection.PortableExecutable;
 
namespace 연습장
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] arr = Console.ReadLine().Split();
            int[] num = new int[arr.Length];
 
            for (int i = 0; i < arr.Length; i++)
                num[i] = int.Parse(arr[i]);
 
            Array.Sort(num);
 
            Console.WriteLine(num[1]);
        }
    }
}
cs