Advertisement
Guest User

Untitled

a guest
Feb 3rd, 2014
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. main()
  4.  
  5. {
  6.  
  7. setbuf(stdout, NULL);
  8.  
  9. int TermLoan, // length of the loan
  10. PaymentNumber, //number of payments made
  11. Numberofmonths, //Number of months in the loan
  12. count,
  13. n; //Letters used for the calculations
  14.  
  15. double AmountPrinciple, //Amount paid on principle
  16. AmountInterest, //amount paid to interest
  17. LoanBlance, //amount owed on loan\ count,
  18. CurrentBlance,
  19. LoanAmount, //amount of the loan
  20. InterestRate, //interest rate on loan
  21. a,i,
  22. NewBlance, //amount of new amount owed
  23. PaymentAmount; //amount paid to loan
  24.  
  25. //start of main program
  26.  
  27. printf ("Please enter in loan amount, Term of Loan and Interest Rate.\n");
  28.  
  29. scanf ("%d%d%lf", &LoanAmount, &TermLoan, &InterestRate);
  30.  
  31. printf ("%d%\n", LoanAmount);
  32.  
  33. printf ("%lf\n", InterestRate);
  34.  
  35.  
  36.  
  37. printf("at line 4\n");
  38.  
  39. CurrentBlance = LoanAmount;
  40.  
  41. Numberofmonths = TermLoan * 12; //calculate numbers of months
  42.  
  43. printf ("at line 1\n");
  44.  
  45. InterestRate = InterestRate / 12;
  46.  
  47. printf ("%d\n", InterestRate);
  48.  
  49. i = InterestRate;
  50.  
  51. n = Numberofmonths;
  52.  
  53. a = CurrentBlance;
  54.  
  55.  
  56.  
  57. printf ("\nAmortization Schedule");
  58.  
  59. printf ("_____________________");
  60.  
  61. PaymentNumber = 0;
  62.  
  63. count =0;
  64.  
  65.  
  66.  
  67. while(PaymentNumber < Numberofmonths) //start of while loop
  68.  
  69. {
  70. printf ("at line 2\n");
  71.  
  72. PaymentAmount = (1+i/12)*n*(i/12*a)/(1+i/12)*n-1;
  73.  
  74. PaymentNumber++; //Start number of months for amortization schedule
  75.  
  76. count++; //Start counter for displaying specific number of payments
  77.  
  78. LoanBlance = PaymentAmount - LoanBlance;
  79.  
  80. AmountInterest = CurrentBlance * InterestRate;
  81.  
  82. AmountPrinciple = AmountInterest - PaymentAmount;
  83.  
  84. NewBlance = CurrentBlance - NewBlance;
  85.  
  86. printf ("%d %d %lf %d", PaymentNumber, LoanBlance, PaymentAmount, AmountPrinciple);
  87. printf ("%f %d\n", AmountInterest, NewBlance);
  88. printf ("at line 3\n");
  89. }//end of while loop
  90.  
  91.  
  92. getchar ();
  93. getchar ();
  94. return 0;
  95.  
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement