C#/알고리즘

백준#10952-A+B - 5

McRobbin 2020. 4. 8. 09:58

https://www.acmicpc.net/problem/10952

 

10952번: A+B - 5

두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오.

www.acmicpc.net

while문으로 분류된 문제입니다.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace _1092
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true) {
                string[] input = Console.ReadLine().Split(' ');
                if (input[0== "0" && input[1== "0")
                    break;
                Console.WriteLine(int.Parse(input[0]) + int.Parse(input[1]));
            }
        }
    }
}
 
 
 

매 반복마다 string으로 입력받아 둘로 나누고 합을 출력했습니다.

특별한 것은 없었으며 두 수가 0일 때 반복을 빠져나옵니다.