/* how long does it take an investment to double? */ while( balance < 2 * initial_balance) { balance = balance * ( 1 + rate / 100); year++; }