ok i need my teach is dead set that is is correct. Can some one pleae run this and tell me if the get teh correct answers
Code:
/*************************************************************
File Name: Tmitchellwk1
Description: Display Loan Amortization Schedule
Date: August 28th, 2006
Designer; Tabatha Mitchell
Assignment: week1
Functions: None
**************************************************************/
#include <stdio.h>
#include <math.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,c; //Letters used for the calculations
double AmountPrinciple, //Amount paid on principle
AmountInterest, //amount paid to interest
LoanBlance, //amount owed on loan\ count,
CurrentBlance,
LoanAmount, //amount of the loan
InterestRate, //interest 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 in months and Interest Rate.\n");
while (scanf("%lf%d%lf", &LoanAmount, &TermLoan, &InterestRate) != 3
|| (LoanAmount < 0 || TermLoan < 0 || InterestRate < 0 ))
{
while ((c = getchar()) != '\n' && c != EOF);
printf ("Please re-enter in loan amount, Term of Loan in months and Interest Rate.\n");
}
CurrentBlance = LoanAmount;
Numberofmonths = TermLoan;
i = InterestRate;
n = Numberofmonths;
a = CurrentBlance;
PaymentNumber = 0;
count = 0;
printf ("\amortization Schedule\n");
printf ("_____________________\n");
PaymentAmount = pow((1+i/12),n)*(i/12*a)/pow((1+i/12),n)-1;
while(PaymentNumber < Numberofmonths)
{
//[ (1 + i / 12) ** n * (i / 12 * a) ] / [ (1 + i / 12) ** n – 1 ]
PaymentNumber++; //Start number of months for amortization schedule
count++;
AmountInterest = a * (i/12);
AmountPrinciple = PaymentAmount - AmountInterest;
LoanBlance = a -AmountPrinciple;
printf ("CurrentBlance %.2f\n", a);
printf ("InterestRate %.2f\n", i);
printf ("PaymentNumber %d\n", PaymentNumber);
printf ("LoanBlance %.2f\n", LoanBlance);
printf ("PaymentAmount %.2f\n", PaymentAmount);
printf ("AmountPrinciple %.2f\n", AmountPrinciple);
printf ("AmountInterest %.2f\n", AmountInterest);
printf ("_______________________\n\n");
a = LoanBlance;
}//end of while loop
getchar ();
getchar ();
printf ("hit enter to end");
return 0;
}