New update is available. Click here to update.


Posted: 4 Mar, 2021
Difficulty: Easy


Try Problem

You are given a string 'S' of length 'N' representing an arithmetic expression. Your task is to compute the result of the expression.

For Example:
If the given arithmetic expression is: “2*3+5/6*3+15”, then the output will be 23.5.


1. The arithmetic expression consists of positive integers, +, -, *, and / (no parentheses).

2. The given input will always be a valid arithmetic expression.

3. There will be at least one integer in the given arithmetic equation.
Input Format:
The first line of the input contains an integer T denoting the number of test cases.

The first line of each test case contains one integer N, as described in the problem statement.

The second line of each test case contains one string of length N, representing a valid arithmetic expression.
Output Format:
For each test case, print a single line containing a single integer representing the result of the given arithmetic equation.

The output for each test case will be printed in a separate line.

Your answer will be considered correct if its absolute or relative error doesn’t exceed 10 ^ (-6).
You do not need to print anything. It has already been taken care of. Just implement the given function.
1 <= T <= 100
1 <= Length of the given string, N <= 30
It is guaranteed that the string will only be consisting of positive integers, +, -, * and / (no parentheses).
0 < positive integers <= 15

Time Limit: 1 sec.