Jump to content

sample code for compound interest


vj5

Recommended Posts

Can someone please help with a simple sample code to calculate compound interest with explanation? I guess the formula for compound interest is FV=P(1+r) to the number of years. FV is Future Value and P is Principal amount, r is the interest rate. I am not sure if the formula is correct.

Link to comment
Share on other sites

I'm not sure what language you want to do this in, but if you're using Javascript you can use Math.pow for the exponent:http://devguru.com/technologies/javascript/10754.aspPHP has a pow function to do the same thing:http://www.php.net/manual/en/function.pow.phpThere's nothing special to do for multiplication and addition, the + and * operators do those.

Link to comment
Share on other sites

I'm not sure what language you want to do this in, but if you're using Javascript you can use Math.pow for the exponent:http://devguru.com/technologies/javascript/10754.aspPHP has a pow function to do the same thing:http://www.php.net/manual/en/function.pow.phpThere's nothing special to do for multiplication and addition, the + and * operators do those.
Thankyou.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...