Jump to content

sample code for compound interest


vj5
 Share

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...