본문 바로가기
알고리즘/백준 문제 풀이

[BOJ/백준] 10950번 A + B - 3 - [c/c++] 풀이

by 미니상미니 2022. 10. 10.
반응형

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

 

10950번: A+B - 3

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

www.acmicpc.net

 

 

 

 


  • 문제

단계별로 풀어보기 - 반복문 - [3단계] 10950번


해설

간단한 반복문 문제이다.

 

코드

c

#include <stdio.h>

int main() {

    int t, a, b;

    scanf("%d", &t);

    for (int i = 0; i < t; i++) {
        scanf("%d %d", &a, &b);
        printf("%d \n", a + b);
    }

    return 0;
}

 

c++

#include <iostream>

using namespace std;

int main() {

    int t;
    int a, b;
    cin >> t;

    for (int i = 0; i < t; i++) {
        cin >> a >> b;
        cout << a + b << '\n';
    }

    return 0;
}

 

 

 

 

 

반응형

댓글