...

/

Evaluate Arithmetic Expressions

Evaluate Arithmetic Expressions

Evaluate the result of an arithmetic expression given as a string.

Statement

Given an arithmetic expression as a string, evaluate its result. For simplicity, let’s assume that there are no parentheses in the expression and only the following binary operations are allowed: (+  \space -  \space *  \space /).

Examples

Here are a few examples of expressions and their results:

2+3=52+3=5

6+4/22=106+4/2*2=10

3+2.45/8=3.306253+2.45/8=3.30625

Access this course and 1400+ top-rated courses and projects.