/*
* Monthly car payment
*/
#include <stdio.h> /* printf, scanf definitions */
#include <math.h>
int
main (void)
{
double down_payment_price; /* input - down payment price */
double purchase_price; /* input - purchase price */
double n; /* input - total number of payments */
double annaual_interest_rate; /* input - annaual interest rate */
double total_number_of_payments; /* input - total number of payments */
double monthly_car_payment; /* output- monthly payment */
double p; /* output- principal */
double I; /* output - monthly interest rate */
/* get the down payment of car */
printf("enter down payment price> ");
scanf("%lf", down_payment_price);
/* get purchase price */
printf(" enter purchase price> ");
scanf("%lf", purchase_price);
/* get total number of payments */
printf(" enter total number of payments> ");
scanf("%lf", n);
/* get annaual interest rate */
printf(" enter annaual interest rate> ");
scanf("%lf", annaual_interest_rate);
/* get the total number of payments */
printf(" the total number of payments> ");
scanf("%lf", total_number_of_payments);
/* calculate amount borrowed */
p = purchase_price - down_payment_price;
/* calculate monthly interest rate */
I = annaual_interest_rate /2
/* calculate monthly car payment */
monthly_car_payment = 1-(1+I)^-n/I*p
/* display the monthly car payment */
printf("\n the monthly car payment is %.f", monthly_car_payment);
return (0)
}
C:\Users\student\Documents\monthly car payment.c(47): error #2001: Syntax error; found 'monthly_car_payment' expecting ';'.
C:\Users\student\Documents\monthly car payment.c(50): error #2168: Operands of ^ have incompatible types 'double' and 'double'.
C:\Users\student\Documents\monthly car payment.c(50): error #2001: Syntax error; found 'printf' expecting ';'.
C:\Users\student\Documents\monthly car payment.c(53): error #2001: Syntax error; found '}' expecting ';'.
*** Error code: 1 ***