백준 BOJ C# 10817 세 수

2020. 1. 10. 15:08백준 알고리즘 단계별/if 문

반응형

출제 링크 : https://www.acmicpc.net/problem/10817

 

10817번: 세 수

첫째 줄에 세 정수 A, B, C가 공백으로 구분되어 주어진다. (1 ≤ A, B, C ≤ 100)

www.acmicpc.net

 

코드

나만의 로직을 짜보고 코드로 옮겼다.

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using static System.Console;
 
namespace baekjoon
{
    class Program
    {
        static void Main(string[] args)
        {
            string inputA = Console.ReadLine();
            string[] intputAll = inputA.Split();
 
            int A = int.Parse(intputAll[0]); // 첫째
            int B = int.Parse(intputAll[1]); // 둘째
            int C = int.Parse(intputAll[2]); // 셋째
 
            if (A >= B)
            {
                if (A >= C)
                {
                    if (B >= C)
                    {
                        WriteLine(B);
                    }
                    else
                        WriteLine(C);
                }
                else
                    WriteLine(A);
            }
            else
            {
                if (B >= C)
                {
                    if (A >= C)
                    {
                        WriteLine(A);
                    }
                    else
                        WriteLine(C);
                }
                else
                    WriteLine(B);
            }
        }
    }
}
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs
반응형