<?php
$deposit = 100;
$rate = .05;
// $rate = $rate / 100;
$year = 0;
$years = 5;
$total = 0;
while($year < $years){
$year++;
$deposit = $deposit + ($deposit * $rate);
echo "<strong>Year " .$year . ": </strong>";
if($year < $years) {
$deposit += 100;
} else {
echo "\n";
}
$total = $deposit;
}
echo "-------------------------" . "\n<strong> Total: </strong>" . number_format($total,2);
IDw/cGhwCgokZGVwb3NpdCA9IDEwMDsKJHJhdGUgPSAuMDU7Ci8vICRyYXRlID0gJHJhdGUgLyAxMDA7CiR5ZWFyID0gMDsKJHllYXJzID0gNTsKJHRvdGFsID0gMDsKCgp3aGlsZSgkeWVhciA8ICR5ZWFycyl7CgkkeWVhcisrOwogICAgJGRlcG9zaXQgPSAkZGVwb3NpdCArICgkZGVwb3NpdCAqICRyYXRlKTsKCWVjaG8gIjxzdHJvbmc+WWVhciAiIC4keWVhciAuICI6IDwvc3Ryb25nPiI7CglpZigkeWVhciA8ICR5ZWFycykgewoJIGVjaG8gbnVtYmVyX2Zvcm1hdCgkZGVwb3NpdCwyKSAuIlxuIjsKCSAkZGVwb3NpdCArPSAxMDA7CgkgfSBlbHNlIHsKCQllY2hvICJcbiI7CQoJIH0KCSAKICAgICR0b3RhbCA9ICRkZXBvc2l0Owp9CgplY2hvICItLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tIiAuICJcbjxzdHJvbmc+IFRvdGFsOiA8L3N0cm9uZz4iIC4gbnVtYmVyX2Zvcm1hdCgkdG90YWwsMik7CiAgICAgICAgICAgIA==