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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formula

Status
Not open for further replies.

aballbest

Technical User
Feb 21, 2002
2
0
0
US
Trying to write a program with an equation to figure monthly payment.

This is what I have. Any suggestions on how to correct?

float principal;
float rate;
float length;
double total;

printf(" Big Deal Loan Calculator\n");
printf(" By: Bret Wilson\n\n");

printf("Enter Loan Amount $");
scanf("%f", &principal);

printf("Enter Length of Loan ");
scanf("%f", &length);

printf("Enter APR ");
scanf("%f", &rate);

printf("Loan Amount=$%2f\n", principal);
printf("Length of Loan=%2.0f\n", length);
printf("APR=%3.1f\n\n", rate);
total = (principal * ((1/1200)* rate)) / (1 - powf (1 + ((1/1200) * rate), -length));
printf("Your Payment is %6.2f per month\n\n", total);
getchar();

}
 
I think that comma before -length is throwing it off. Does that powf function return anything? Put whatever powf returned into a variable. And just do 1 - vpowf - length. Lemme know if you need more help.

-CDudd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top