작성일 :

문제 링크

14918번 - 더하기

설명

정수 a, b를 입력받아 a + b를 출력합니다. 값은 -100000 이상 100000 이하입니다.


접근법

두 수를 입력받아 더한 뒤 출력하면 됩니다. 특별한 예외나 자료형 주의 사항은 없습니다.



Code

C#

1
2
3
4
5
6
7
8
9
10
11
12
using System;

namespace Solution {
  class Program {
    static void Main(string[] args) {
      var parts = Console.ReadLine()!.Split();
      int a = int.Parse(parts[0]);
      int b = int.Parse(parts[1]);
      Console.WriteLine(a + b);
    }
  }
}

C++

1
2
3
4
5
6
7
8
9
10
11
#include <bits/stdc++.h>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int a, b; cin >> a >> b;
  cout << a + b << '\n';
  return 0;
}