Simple calculator
Can you write a simple calculator?
The input contains 1 integer, an operation
+-*/
, and another integer. The output should contain the result of the expression. If the operation is not one of the +-*/
, the program should print Unsupported operation
. If the program encounters division by 0, it should print Cannot divide by 0
.Input | Output |
2
*
2 | 4 |
2
/
0 | Cannot divide by 0 |
Constraints
Time limit: 2 seconds
Memory limit: 512 MB
Output limit: 1 MB