#C7768. Basic Calculator

    ID: 51675 Type: Default 1000ms 256MiB

Basic Calculator

Basic Calculator

This problem requires you to implement a simple calculator. You are given multiple arithmetic expressions, and you need to evaluate each expression and output its result on a new line. The allowed operators are addition (+), subtraction (-), multiplication (*), and integer division (/). For division, if the divisor is 0, output Error: Division by zero instead of a number.

Each test case is provided as several lines containing an expression in the format a operator b where a and b are integers. The input is terminated by a single line that contains only 0, which should not be processed.

inputFormat

The input consists of multiple lines. Each line (except the last terminating line) contains a single arithmetic expression in the format a operator b, where:

  • a and b are integers.
  • operator is one of +, -, *, or /.

The input ends when a line containing exactly 0 is encountered. This line should not be processed.

outputFormat

For every arithmetic expression (except the terminating 0), output the result on a new line. If the operation is division and the divisor is 0, print Error: Division by zero. Otherwise, for division, perform integer division.

## sample
12 + 25
100 - 99
9 * 3
16 / 4
7 / 0
0
37

1 27 4 Error: Division by zero

</p>