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();
}
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();
}