Language C Description You have saved CFA500 to use as down payment on a car. Before beginning your car shopping, you decide to write a program to help you figure out what your monthly payment will be, given the car's purchase price, the montly interest rate, and the time period over which you will pay back the loan. The formula for calculating your payment is: payment=P/(1-(1+i)^n)) P = principal (the amount you borrow) i = monthly interest rate (12 of the annual rate) n = total number of payments Your program should prompt the user for the purchase price, the down payment, the annual interest rate, and the total number of payments (usually 36, 48, or 60). It should then display the amount borrowed and the monthly payment including a dollar sign and two decimal places.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main (void)
{
float amount_borrowed, annual_interest_rate, down_payment, monthly_payment, montly_interest_rate;
float number_of_payments, payment, purchase_price;
printf ("Enter the value of annual interest rate: ");
scanf ("%f", &annual_interest_rate);
(void) getchar ();
printf ("Enter the value of down payment: ");
scanf ("%f", &down_payment);
(void) getchar ();
printf ("Enter the value of number of payments: ");
scanf ("%f", &number_of_payments);
(void) getchar ();
printf ("Enter the value of purchase price: ");
scanf ("%f", &purchase_price);
(void) getchar ();
montly_interest_rate=annual_interest_rate/12;
amount_borrowed=purchase_price-down_payment;
payment=amount_borrowed/(1.0-pow(1.0+montly_interest_rate,number_of_payments));
monthly_payment=payment/number_of_payments;
printf ("Value of amount borrowed: %g\n", amount_borrowed);
printf ("Value of monthly payment: %g\n", monthly_payment);
printf ("Value of montly interest rate: %g\n", montly_interest_rate);
printf ("Value of payment: %g\n", payment);
putchar ('\n');
system ("pause");
return EXIT_SUCCESS;
}