Simple calculator

Write a program to simulate a very simple calculator (with no brackets, nor priorities, nor associativeness of the operators).

Input

Input starts with the number of computations. All operands are real non-negative numbers written in the usual way. The operators of sum, substraction, product and division (‘+’, ‘-’, ‘’ and ‘/’, respectively). An ‘=’ indicates the end of the current computation. Input can contain several spaces between the operators and the operands, but is syntactically correct.

Output

For each computation, print its result with 5 digits after the decimal point. Print “ERROR” for any computation that has any division by zero.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T10:27:00.685Z

© Jutge.org, 2006–2026.
https://jutge.org