Code:

<script type = "text/javascript">
var fee5 = 100;
for (var i=0; i<5; i++) {
var fee5 = fee5 * 1.05
}
alert (fee5.toFixed(2));
var fee10 = 100;
for (var i=0; i<10; i++) {
var fee10 = fee10 * 1.05
}
alert (fee10.toFixed(2));
var fee15 = 100;
for (var i=0; i<15; i++) {
var fee15 = fee15 * 1.05
}
alert (fee15.toFixed(2));
</script>

Not using a loop:-

Code:

var fee = 100;
var ratepc = 5;
var years = 5;
var fee5 = Math.round(fee*(Math.pow((1+ratepc/100),years))*100)/100;
alert (fee5);
years = 10;
var fee10 = Math.round(fee*(Math.pow((1+ratepc/100),years))*100)/100;
alert (fee10);
years = 15;
var fee15 = Math.round(fee*(Math.pow((1+ratepc/100),years))*100)/100;
alert (fee15);

Another way:-

Code:

var fee = 100;
var ratepc = 5;
var fee5 = calc(5);
alert (fee5);
var fee10 = calc(10);
alert (fee10);
var fee15 = calc(15);
alert (fee15);
function calc(years){
var result = Math.round(fee*(Math.pow((1+ratepc/100),years))*100)/100;
return result
}