5000 * 1.12 ^ 46 = $918330.58
Start with 5000.
Every year, you add 12%, or the number is 120% of the previous year.
Add 12% to the previous year for 46 years means...
$5000 * 1.12 * 1.12 * 1.12 * 1.12 ... * 1.12
or
$5000 * 1.12 ^ 46
Code:
$X = 5000;
$y = 1.12;
for($i=0;$i<46;++$i){
$X=$X*$y;
}
$X=$X-($X*0.3);
return $X;
