Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Pera

Problemset: เส้นทางคณิตศาสตร์

Language: cpp

Time: 0.002 second

Submitted On: 2025-09-03 17:41:31

#include <bits/stdc++.h>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);

    int x, y, z; cin >> x >> y >> z;

    switch (z)
    {
    case 1:
        cout << x + y << '\n';
        break;
    case 2:
        cout << x - y << '\n';
        break;
    case 3:
        cout << x * y << '\n';
        break;
    case 4:
        if (y == 0) {
            cout << "cannot divide by zero" << '\n';
            break;
        }
        cout << x / y << '\n';
        break;
    case 5:
        if (y == 0) {
            cout << "cannot divide by zero" << '\n';
            break;
        }
        cout << x % y << '\n';
        break;
    default:
        break;
    }
}