if p= initial loan amount i = annual interest rate l= length to be paid back in
ID: 3626992 • Letter: I
Question
ifp= initial loan amount
i = annual interest rate
l= length to be paid back in years
j = monthly interest rate in floating point form: j= i/(12*100)
n = the number of months over which the loan is amortized :n = l*12
the formula for the payment is
monthly payment = p*(j/(1-(1-(1+j)**-n)) where "**" denotes exponentiation
to calc the amortization table you will need to perform the following iterations
1. calc the current monthly interest
2. calc the monthly principal amount
3. calc the new balance
4. set the principal p = new balance then go back to step 1.
QUESTIONS
1.USE A FUNCTION TO PRODUCE AN AMORTIZATION TABLE
2. COMPUTE THE TOTAL INTEREST PAID ON THE LOAN
Explanation / Answer
please rate - thanks
#include<stdio.h>
#include <conio.h>
#include<math.h>
void printtable(double,double,int);
int main ()
{
double principal, rate;
int month;
printf("Enter the principal of the loan: ");
scanf("%lf",&principal);
printf("What is the term of the loan (in years)? ");
scanf("%d",&month);
month*=12;
printf("What is the Annual Interest Rate)? ");
scanf("%lf",&rate);
printtable(principal,rate,month);
getch();
return 0;
}
void printtable(double principal,double rate,int month)
{int cnt;
double interest, tot=0,mpay, factor, mrate;
mrate=(rate/1200);
factor=pow(mrate+1,month);
factor--;
mpay=(mrate+(mrate/factor))*principal;
printf("Principal: $ %.2f ",principal);
printf("Annual Interest Rate: %.2f%% ",rate);
printf("Term: %d months ",month);
printf("Monthly Payment: $%.2f ",mpay);
printf("Payment Interest Principal Balance ");
cnt = 0;
while(cnt<month)
{interest=principal*(rate/100)*(month/12.)/month;
tot+=interest;
printf("%2d $%6.2f $%7.2f",cnt,interest,principal);
principal=principal+interest-mpay;
printf(" $%6.2f ",principal);
cnt++;
}
interest = (principal*(rate/100))/month;
printf("Final Payment: $%6.2f ",fabs(principal+interest-mpay));
printf("Total interest paid $%6.2f ",tot);
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.