#B4154. Simple Calculator
Simple Calculator
Simple Calculator
This problem requires you to implement a simple calculator that supports four operations: addition, subtraction, multiplication, and division. The input consists of two integers and an operator, separated by spaces. You are guaranteed that the input values are within the range of the C++ int type. In the case of division, the divisor is non-zero and the division will yield an integer result. The task is to perform the calculation and output the result.
inputFormat
The input consists of a single line containing two integers and an operator separated by spaces. The format is:
A op B
Here, A and B are integers, and op is one of the characters: +
, -
, *
, or /
.
outputFormat
Output a single integer which is the result of the operation.
sample
3 + 4
7