Ref URL; http://en.wikipedia.org/wiki/Future_value
Earlier similar question; calculate Future value in iPhone
Like we hvae PV (Present value0, FV (Future value), No. of years (N) and growth rate (%)
How can we calculate growth rate (or interest rate) using the other 3 variables in iPhone?
Code for FV below;
-(float) calcFVFromPresentValue: (float) pv interest_rate: (float) interest_rate time: (float) time
{
float fv;
//pv = 200000.0; // present value
//i = 0.012; // interest rate (1.2%)
//t = 5.0; // time period
fv = pv * pow (1.0 + interest_rate, time);
return fv;
}
since r = (FV/PV)^(1/t) – 1, in Objective-C and your variables:
note: in the future, try doing it on your own first, we’re not code monkeys (i add this edit after i monkey your code of course :p)
edit2: left off the minus 1 in the formula.