-3

User made some calculations using program..and printed it on paper.. But mouse cut some part from the paper.

Now we have to create the program to find missing values.

Example:

54 + 27 = HOLE
3241 + 4HOLE45=7281

We have to find the missing value at HOLE. If we pass multiple eqution at a time.

1 Answers1

0

If (like in your example) the equations are separated by line breaks (or any other character will work) simply separate the equations maybe into custom objects then you can split each equations to numbers by splitting at every arithmetic symbols.

What I am suggesting is to phrase each line as an equation and find the missing bit by comparing both sides of the equal sign. You can find any one missing number each from any equation like this.

I have not provided any code example because you have not provided any code that you have currently tried out and also no specific language is specified. If you follow up with those I am ready to give a code sample.

Rohit
  • 495
  • 9
  • 16
  • I agree but when we have input like: 1234 + 3HOLE5 = 4669 .. Here HOLE=43... I am confused about this only.. I got your point by the way thanks.. But it would be great if you clarify me about this. – Akash Khapale Aug 14 '19 at 16:43
  • In this case you can break this equation into two equations as 305 + HOLE * 10 = 4669 - 1234. To do this you can check if a HOLE is followed and preceded by a number or white space. If it is a number convert it as show. This can be done fairly easily. – Rohit Aug 16 '19 at 14:54
  • After this the new equation can be passed to the equation solver. – Rohit Aug 16 '19 at 14:55