Question: Write a GO language program to solve a simple mathematical puzzle. The program must efficiently find the binary operators that complete the equation. For this
Write a GO language program to solve a simple mathematical puzzle. The program must efficiently find the binary operators that complete the equation. For this problem the only operators you need to consider are addition, subtraction, multiplication, and division (when the divisor is non-zero and the remainder is zero). For example, given 1 O 2 = 3 the only operator that works to put in the circle is "+". So 1 + 2 = 3 solves the problem.
For simplicity we will not use the normal operator precedence. Instead there will be no precedence thus expressions are evaluated strictly from left to right. For example, given 1 O 2 O 3 = 1, your goal is to find two operators that satisfy the equation. The solution would be 1 + 2 / 3 = 1. Notice that this is computed as (1+2) / 3 = 1 and not 1 + (2/3).
Generating your own example problems is easy. Write an equation (being careful to evaluate it strictly left to right) and then remove the operators and supply that to your program.


With multiple solutions it looks like: $echo"7337"gorun.all7+33=7,73+3=7,73/3=7$gorun.all
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
