I cannot figure out how to write this equation into a program.
P = Ar /( 1 - (1 + r) to the negative n power)
Printable View
I cannot figure out how to write this equation into a program.
P = Ar /( 1 - (1 + r) to the negative n power)
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 );
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