Problem: Given the amount to borrow for a given loan in addition to the annual i
ID: 3639934 • Letter: P
Question
Problem: Given the amount to borrow for a given loan in addition to the annual interest rate and term in yearsdisplay the corresponding monthly amortization table (including every payment for the loan).
Example Execution:
Enter the amount to borrow: 5000
Enter the annual interest rate: 11
Enter the term of the loan in years: 1
Month Old Monthly Interest Principal New
Balance Payment Paid Paid Balance
1 5000.00 441.91 45.83 396.07 4603.92
2 4603.92 441.91 42.20 399.71 4204.22
3 4204.22 441.91 38.54 403.37 3800.85
4 3800.85 441.91 34.84 407.07 3393.78
5 3393.78 441.91 31.11 410.80 2982.98
6 2982.98 441.91 27.34 414.56 2568.42
7 2568.42 441.91 23.54 418.36 2150.06
8 2150.06 441.91 19.71 422.20 1727.86
9 1727.86 441.91 15.84 426.07 1301.79
10 1301.79 441.91 11.93 429.98 871.81
11 871.81 441.91 7.99 433.92 437.89
12 437.89 441.91 4.01 437.89 0.00
Explanation / Answer
please rate - thanks
#include<stdio.h>
#include <conio.h>
#include<math.h>
void printtable(double,double,int);
int main ()
{int cnt;
double principal, rate;
double interest, tot=0,mpay, factor, mrate;
int month;
printf("Enter the principal of the loan: ");
scanf("%lf",&principal);
printf("What is the Annual Interest Rate)? ");
scanf("%lf",&rate);
printf("What is the term of the loan (in years)? ");
scanf("%d",&month);
month*=12;
mrate=(rate/1200);
factor=pow(mrate+1,month);
factor--;
mpay=(mrate+(mrate/factor))*principal;
printf(" ");
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+1,principal,interest);
principal=principal+interest-mpay;
printf(" %7.2f ",principal);
cnt++;
}
getch();
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.