상세 컨텐츠

본문 제목

백준#10952-A+B - 5

C#/알고리즘

by 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일 때 반복을 빠져나옵니다.

'C# > 알고리즘' 카테고리의 다른 글

백준#5585 - 거스름돈  (0) 2020.04.08
백준#10951 - A+B - 4  (0) 2020.04.08
백준#1931-회의실배정  (0) 2020.04.07
백준#11047-동전 0  (0) 2020.04.07
백준#11399-ATM  (0) 2020.04.07

관련글 더보기