Amazon.com

www.amazon.com
Engaged Employer

## Interview Question

Interview Syracuse, NY

# Second Round: This was a bit difficult. The question is to

generate sample math problems(additions) for a 8th grade student and the results should be stored in such a way that they can be printed when required. Sample problem is 7+8=_____ The constraints are:- 1) The numbers that are to be added should be &lt;=9 2) The result should be &lt;=17

0

this actually fairly simple, for the second constraint its x+y <=17, then all you need to do is have a random generator that finds some x solve for y (i.e. y<=17-x, that way you dont have to use the random generator twice and then have run it multiple times to make sure the result is valid) then a simple if statement to test whether user input is correct

Marc Fuller on Jan 27, 2014
0

one more thing to get every result less than 17 , you would have to another if statement that uses 2 randomly generatored numbers if x+y <=17 isnt true do what i mentioned earlier

Marc Fuller on Jan 27, 2014