This seems to work. I have changed a few of the terms and fiddled with it a bit
but it should be easy to see what is what.
Code:
/*************************************************************
File Name: Tmitchellwk1
Descreption: Display Loan Amortization Schedule
Date: August 28th, 2006
Desinger; Tabatha Mitchell
Assugnment: week1
Fuctions: None
**************************************************************/
#include <stdio.h>
/*Program to compute Amortization Schedule*/
main ()
{
int TermLoan, // length of the loan
PaymentNumber, //number of payments made
Numberofmonths, //Number of months in the loan
count,
n; //Letters used for the caculations
double AmountPrinciple, //Amount paid on principle
AmountInterest, //amount paid to intrest
LoanBlance, //amount owed on loan\ count,
CurrentBlance,
LoanAmount, //amount of the loan
InterestRate, //intrest rate on loan
a,i,
NewBlance, //amount of new amount owed
PaymentAmount; //amount paid to loan
//start of main program
printf ("Please enter in loan amount, Term of Loan and Intrest Rate.\n");
scanf ("%lf%d%lf", &LoanAmount, &TermLoan, &InterestRate);
CurrentBlance = LoanAmount;
Numberofmonths = TermLoan * 12 ; //calculate numbers of months
i = InterestRate;
n = Numberofmonths;
a = CurrentBlance;
NewBlance=a;
printf ("\nAmortization Schedule\n");
printf ("_____________________\n");
printf ("PaymentNumber, LoanBlance, PaymentAmount, AmountPrinciple, AmountInterest, NewBlance\n");
PaymentNumber = 0;
count =0;
while(PaymentNumber < Numberofmonths) //start of while loop
{
PaymentAmount = a*(i/12)*pow((1+i/12),n)/( pow((1+i/12),n) -1);
PaymentNumber++; //Start number of months for amortization schedule
count++; //Start counter for displaying specific number of payments
AmountInterest = NewBlance * i/12;
AmountPrinciple = PaymentAmount - AmountInterest;
NewBlance = NewBlance - PaymentAmount + AmountInterest;
printf ("Payment No %.2d ", PaymentNumber);
printf (" Payment Ammt %.2lf", PaymentAmount);
printf (" Amount prin %.2f ", AmountPrinciple);
printf (" Princiople Int %.2lf ", AmountInterest);
printf ("Newbalance %.2f\n", NewBlance);
} //end of while loop
/* getchar ();*/
getchar ();
printf ("hit enter to end");
return 0;
}
Output:-
Please enter in loan amount, Term of Loan and Intrest Rate.
30000 25 0.070
Amortization Schedule
_____________________
PaymentNumber, LoanBlance, PaymentAmount, AmountPrinciple, AmountInterest, NewBlance
Payment No 1 Payment Ammt 212.03 Amount prin 37.03 Princiople Int 175.00 Newbalance 29962.97
Payment No 2 Payment Ammt 212.03 Amount prin 37.25 Princiople Int 174.78 Newbalance 29925.72
Payment No 3 Payment Ammt 212.03 Amount prin 37.47 Princiople Int 174.57 Newbalance 29888.25
Payment No 4 Payment Ammt 212.03 Amount prin 37.69 Princiople Int 174.35 Newbalance 29850.56
Payment No 5 Payment Ammt 212.03 Amount prin 37.91 Princiople Int 174.13 Newbalance 29812.66
Payment No 6 Payment Ammt 212.03 Amount prin 38.13 Princiople Int 173.91 Newbalance 29774.53
Payment No 7 Payment Ammt 212.03 Amount prin 38.35 Princiople Int 173.68 Newbalance 29736.18
Payment No 8 Payment Ammt 212.03 Amount prin 38.57 Princiople Int 173.46 Newbalance 29697.61
Payment No 9 Payment Ammt 212.03 Amount prin 38.80 Princiople Int 173.24 Newbalance 29658.81
Payment No 10 Payment Ammt 212.03 Amount prin 39.02 Princiople Int 173.01 Newbalance 29619.79
<<<snipped for brevity>>>
Payment No 296 Payment Ammt 212.03 Amount prin 205.96 Princiople Int 6.08 Newbalance 835.91
Payment No 297 Payment Ammt 212.03 Amount prin 207.16 Princiople Int 4.88 Newbalance 628.75
Payment No 298 Payment Ammt 212.03 Amount prin 208.37 Princiople Int 3.67 Newbalance 420.39
Payment No 299 Payment Ammt 212.03 Amount prin 209.58 Princiople Int 2.45 Newbalance 210.80
Payment No 300 Payment Ammt 212.03 Amount prin 210.80 Princiople Int 1.23 Newbalance 0.00
hit enter to end