I cannot figure out how to write this equation into a program.

P = Ar /( 1 - (1 + r) to the negative n power)

Printable View

- 09-19-2001Nate2430I can't figure this out!
I cannot figure out how to write this equation into a program.

P = Ar /( 1 - (1 + r) to the negative n power) - 09-19-2001Dang
Try pow ( declaration in <math.h> ).

pow

Calculates x raised to the power of y.

double pow( double x, double y );

I think you code would look something like this.

P = Ar / pow( ( 1 - ( 1 + r ) ), -n ); - 09-20-2001damyan
Hi

you know from math cources that X^-n is euqal to 1/X^n so try to use thet and rewrite your code usin the positive powers

e.g.

P = Ar /( 1 - 1/pow((1 + r),n)) where n is with the oposite sign from your original post

damyan