Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi, I'm having trouble coding a C program that computes the interest after the user inputs the
loan, monthly payment, and interest rate. Can anyone point me in the right direction (i.e. equations for computing interest?) Thanks for your time.

First off. C is not my cup of tea. 25 years of BASIC, 10 years of Fox Base.
Next you should be familiar with the terms used in financial functions. Very seldom do you start with a monthly payment without knowing the term. In a normal amortized loan the monthly payment consists of two parts the interest charge and the payment to the loan. Interest is simply the interest rate (per period) multiplied by the outstanding balance of the loan. What you remember is the term is usually quoted in years but payments are made monthly and the quoted interest rate is annually but calculated monthly. There are other things to consider: points, effective interest rate, modified terms, irregular payments, balloon payments, negative ammortization, etc.
As you write your code and debug, I would recomment doing the same problem in a spreadsheet. Most spreadsheets have the equivalent financial functions. You should get the same values. Check rounding and significant places.

Most interest is compounded annually, but -
Basically, you subtract standard payments from the principal, then apply the interest rate for that period.
98% of the population is asleep. The other 2% are staring around in complete amazement, abject terror, or both.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |