(구) solved ac class 문제들/class 1

[class 1]백준 사칙연산(10869번) 풀이 (C++/Python)

isekaipudding 2026. 2. 10. 12:33

문제 : 사칙연산(10869번)(Bronze V)

문제 링크 : https://www.acmicpc.net/problem/10869
출처 : Baekjoon Online Judge

 

사칙연산 기초에서 덧셈, 뺄셈, 곱셈, 몫, 나머지를 구현하면 됩니다.

 

[C++]

#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';
    cout << a - b << '\n';
    cout << a * b << '\n';
    cout << a / b << '\n';
    cout << a % b << '\n';
 
    return 0;
}

[Python]

import sys

input = sys.stdin.readline

A, B = map(int, input().split())

print(A + B)
print(A - B)
print(A * B)
print(A // B)
print(A % B)