This boggles my mind

I suck at math I know but I think it's the power that's screwing me up. I can't seem to translate it properly into C++. This is the equation:
( r ( 1 + r )^n )
P = ------------------------ * L
(( 1 + r )^n – 1)

This is how I wrote it:
double P = (1+r)* pow ((1+r),n)/((1+r)* pow ((1+r),n)-1)*L;

Edit: Added "^"
Last edited on
p=((r*pow((1+r),n))/(pow((1+r),n) - 1)) * L;
Last edited on
Sorry I forgot to add the "^" behind the lower n.
I saw your edit and my above formula was edited as well
Last edited on
Thank You! It worked perfectly!
Topic archived. No new replies allowed.