while (balance < targetBalance) { year++; double interest = balance * rate / 100; balance = balance + interest; }