fb pixel

Simple calculator

Can you write a simple calculator?
The input contains 1 number, an operation +-*/, and another number. 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
To check your solution you need to sign in
Sign in to continue