int i = 1;while (i <= n){ double interest = balance * rate / 100; balance = balance + interest; i++;}