Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: JRomsponCH

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

Language: cpp

Time: 0.003 second

Submitted On: 2025-09-29 14:21:49

#include<iostream>
using namespace std;

int main() {
    int n1, n2, s;
    cin>>n1>>n2>>s;
    if (s == 1) {
        cout<<n1 + n2;
    }else if (s == 2) {
        cout<<n1 - n2;
    }else if (s == 3) {
        cout<<n1 * n2;
    }else if (s == 4 and n2 != 0) {
        cout<<n1 / n2;
    }else if (s == 4 and n2 == 0) {
        cout<<"cannot divide by zero";
    }else if (s == 5) {
        cout<<n1 % n2;
    }
    return 0;
}