#Z13209. 简单计算器
简单计算器
Description
A simple calculator that supports four basic operations: addition (+), subtraction (-), multiplication (*), and division (/). Only integer input and output are considered, and the data and results will not exceed the range of the int type.
However:
- If division by zero occurs, output:
Divided by zero! - If an invalid operator (anything other than +, -, *, /) is encountered, output:
Invalid operator!
Input Format
The input consists of a single line with three parameters: the first and second parameters are integers, and the third parameter is the operator (+, -, *, /).
Output Format
The output is a single line containing the result of the operation as an integer.
(Note: The corrected typo in the original text "Divided by zero!" has been adjusted to "Divided by zero!" for consistency.)
1 2 +
3