Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- main()
- {
- setbuf(stdout, NULL);
- int TermLoan, // length of the loan
- PaymentNumber, //number of payments made
- Numberofmonths, //Number of months in the loan
- count,
- n; //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 and Interest Rate.\n");
- scanf ("%d%d%lf", &LoanAmount, &TermLoan, &InterestRate);
- printf ("%d%\n", LoanAmount);
- printf ("%lf\n", InterestRate);
- printf("at line 4\n");
- CurrentBlance = LoanAmount;
- Numberofmonths = TermLoan * 12; //calculate numbers of months
- printf ("at line 1\n");
- InterestRate = InterestRate / 12;
- printf ("%d\n", InterestRate);
- i = InterestRate;
- n = Numberofmonths;
- a = CurrentBlance;
- printf ("\nAmortization Schedule");
- printf ("_____________________");
- PaymentNumber = 0;
- count =0;
- while(PaymentNumber < Numberofmonths) //start of while loop
- {
- printf ("at line 2\n");
- PaymentAmount = (1+i/12)*n*(i/12*a)/(1+i/12)*n-1;
- PaymentNumber++; //Start number of months for amortization schedule
- count++; //Start counter for displaying specific number of payments
- LoanBlance = PaymentAmount - LoanBlance;
- AmountInterest = CurrentBlance * InterestRate;
- AmountPrinciple = AmountInterest - PaymentAmount;
- NewBlance = CurrentBlance - NewBlance;
- printf ("%d %d %lf %d", PaymentNumber, LoanBlance, PaymentAmount, AmountPrinciple);
- printf ("%f %d\n", AmountInterest, NewBlance);
- printf ("at line 3\n");
- }//end of while loop
- getchar ();
- getchar ();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement