ericu wrote:That doesn't add onto the previous years, im usually good at this but im juggling three projects right now and just cant wrap my head around the mathematical equation.
the interest for the next year has to account for the interest that was already added on from the previous year, for instance.
100$ to start, with 10% interest would come out to 110$ after the first year, i then need it to continue to add interest onto that for however many years the user puts in. so the second year should be 110$ * 10% = 111$ and so on and so on.
I just can't think of how to actually write that as a formula
Sorry ericu, from the your op I thought you had the loop down and you just needed the formula. For loop would have worked nice as well.
godpigeon wrote:Though depending on language, there's a difference in for vs while loops... is the logic going to be used at least once or not ;P
It just depends on the condition. If you know how many times you need to loop then for loop it. If the condition is something like "Moonde is now cool and attractive" and we don't know how many iterations of the loop it's going to take to make this condition true then a while loop works. Of course this condition will never end up being true and we'll end up with an infinite loop but that's beside the point!