#C14702. Evaluating Mathematical Expressions
Evaluating Mathematical Expressions
Evaluating Mathematical Expressions
You are given a string representing a mathematical expression composed of non-negative numbers (which may be integers or decimals) and the operators \(+, -, \times, \div\) without any spaces or parentheses. The expression must be evaluated following the standard operator precedence: multiplication and division are performed before addition and subtraction.
For example, given the input 3+5*2
, the correct output is 13.0.
inputFormat
A single line containing a mathematical expression consisting of non-negative numbers (which may include decimals) and the operators +, -, *, /. There are no spaces in the expression.
outputFormat
A single number representing the evaluated result of the expression. The result should be displayed in a floating-point format.## sample
3+5
8.0