#K90782. Text Based Calculator
Text Based Calculator
Text Based Calculator
In this problem, you are required to implement a basic calculator that evaluates a simple arithmetic expression provided as a string. The expression will always be in the format (a ; ; b), where (a) and (b) are integers and is one of the four arithmetic operators: +, -, *, or /. For division, if the result is an exact integer, output it as an integer; otherwise, output the exact decimal value. This problem tests your ability to parse input and perform fundamental arithmetic operations.
inputFormat
The input consists of a single line that contains an arithmetic expression in the format: (a ; ; b). Here, (a) and (b) are integers and is one of '+', '-', '*', or '/'.
outputFormat
The output is a single value: the result of the arithmetic operation. If the division operation results in an exact integer, print it as an integer; otherwise, print the decimal value.## sample
3 + 4
7