백준 10952

Hyerin·2021년 12월 12일
0
post-thumbnail

문제

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

C# 풀이

using System;
using System.IO;

namespace baekjoon
{
    class Program
    {
        static void Main(string[] args)
        {
            // 표준 입출력 스트림 reader,writer 만들기
            // 각 테스트 케이스에 a, b 입력받기, 분리하기, int로 바꾸기
            // a 와 b 더하기
            // 버퍼에 저장, 버퍼 한 번에 비우기

            StreamReader sr = new StreamReader(Console.OpenStandardInput());
            StreamWriter sw = new StreamWriter(Console.OpenStandardOutput());

            while (true)
            {
                string strInput = sr.ReadLine();
                string[] strNum = strInput.Split(' ');
                int nNumA = int.Parse(strNum[0]);
                int nNumB = int.Parse(strNum[1]);
                
                if (nNumA == 0 && nNumB == 0)
                {
                    break;
                }

                sw.WriteLine(nNumA + nNumB);
            }

            sw.Flush();
            sr.Close();
            sw.Close();
        }
    }
}

0개의 댓글