2 solutions
-
0
Guest MOD
-
1
#include <bits/stdc++.h> using namespace std; int main() { int a,b;char c; cin >> a >> b >> c; if(c == '+') { cout << a + b; } if(c == '-') { cout << a - b; } if(c == '*') { cout << a * b; } if(c == '/') { if(b == 0) { cout << "Divided by zero!"; } else { cout << a / b; } } if(c != '+' && c != '-' && c != '*' && c != '/') { cout << "Invalid operator!"; } return 0; }
Information
- ID
- 675
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 7
- Tags
- (None)
- # Submissions
- 129
- Accepted
- 32
- Uploaded By