작성일 :

문제 링크

11022번 - A+B - 8

설명

기본적인 사칙 연산과 반복문을 사용하는 문제입니다.


Code

[ C# ]

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
namespace Solution {
  class Program {
    static void Main(string[] args) {

      var cntCase = int.Parse(Console.ReadLine()!);

      for (int i = 1; i <= cntCase; i++) {
        var input = Console.ReadLine()!.Split(' ');
        var a = int.Parse(input![0]);
        var b = int.Parse(input![1]);

        Console.WriteLine($"Case #{i}: {a} + {b} = {a + b}");
      }

    }
  }
}



[ C++ ]

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <bits/stdc++.h>

using namespace std;

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

  int cntCase; cin >> cntCase;

  for (int i = 1; i <= cntCase; i++) {
    int a, b; cin >> a >> b;

    cout << "Case #" << i << ": " << a << " + " << b <<
            " = " << a + b << "\n";
  }

  return 0;
}