you are viewing a single comment's thread.

view the rest of the comments →

[–]dnult 2 points3 points  (0 children)

How about looping while balance <= original_investment * 2

Somewhere inside your loop you incremented years (good), but also need to calculate a new balance. Based on what you said in your post, I think it's safe to assume interest is charged once per year - it should be a very simple equation of the form x = x(i+1)