Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formula problem

Status
Not open for further replies.

aballbest

Technical User
Joined
Feb 21, 2002
Messages
2
Location
US
Forgive an old man. I am trying to help my son as he learns C++. It has been 30 years since I took my programming in college. Need to know how to write the formula
a= pr
-----------------
1_[1+r]-n



a is given loan amount, APR and length of loan.

p is a standard dollar figure
r is 1 twelvth of the APR
n is number of monthly payments which will be an integer greater than zero and could reach 60

here is what he and I have so far total = (principal * (1/12)*rate) / (1 - powf((1 + (1/12)*rate), -length));


any help is appreciated.
 
here is what he and I have so far total = (principal * (1/12)*rate) / (1 - powf((1 + (1/12)*rate), -length));

double x = rate/12.
x++;
double y = - length;
double denom = pow(x,y);
denom = 1 - denom;
double numer = princi /12. * rate;
double a = numer / denom;

This will work;
R.Sathish.
babusats@rediffmail.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top