Want a Free Job Posting?

Buy a job posting today and the second one is on us. For a limited time only. Act Now.

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 <=9 2) The result should be <=17

Interview Answer

2 Answers


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

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

Add Answers or Comments

To comment on this, Sign In or Sign Up.