f# - fsharp compound interest beginner -
i not know i'm supposed here beginner
let interest = 0.02 // interest rate 2% let periods = 12.0 // number of times interest compounded per year let years = 10.0 // number of years money borrowed // calculate compound interest using formula from: // http://en.wikipedia.org/wiki/compound_interest#compound_interest let compound investment = ***i supposed put here*** let res = compound 1000.0 shouldequal (round res) 1221.0 printfn "compound interest (full): %f" res printfn "compound interest (two digits): %.2f" res
if right understand:
let interest = 0.02 // interest rate 2% let periods = 12.0 // number of times interest compounded per year let years = 10.0 // number of years money borrowed let investment = 1000.0 //principal amount (initial investment) // calculate compound interest using formula from: // http://en.wikipedia.org/wiki/compound_interest#compound_interest let compound p j n t = p*((1.0+j/n)**(n*t)) let res = compound investment interest periods years //shouldequal (round res) 1221.0 ? this? printfn "compound interest (full): %f" res printfn "compound interest (two digits): %.2f" res
but i'm surprised saw question here
Comments
Post a Comment