New to C and going to be learning it so I can develop strong fundamentals so I decided to sign up here. Thanks for the help in advanced. What's wrong with my code — it crashes on the final printf()
line?
#include <stdio.h>
main(int argc, char *argv[])
{
// car loan calculator
int carPrice, carDownPayment, loanTerm;
float loanInterestRate, salesTax;
printf("What is the price of the car? ");
scanf("%d", &carPrice);
printf("How much down payment do you have? ");
scanf("%d", &carDownPayment);
printf("What is your loan's interest rate? ");
scanf("%f", &loanInterestRate);
printf("What is your sales tax? ");
scanf("%f", &salesTax);
printf("What is your loan term? ");
scanf("%d", loanTerm);
printf("The price of the car is %d. Your down payment is %d. Your loan interest rate is %1f. Sales tax is %2f. Your loan term is %d.", carPrice, carDownPayment, loanInterestRate, salesTax, loanTerm);
float monthlyPayment;
printf("Your monthly should be about %3.2f dollars over a term of %d months."), (carPrice * salesTax * loanInterestRate - carDownPayment / loanTerm), loanTerm;
return 0;
}