I have a homework assignment to create a calculator that calculates a monthly payment, given a certain loan amount, APR, and loan term (in years). What is the formula I need to use?
Using the following variables
s = principal r = periodic rate n = number of periods d = periodic payment
Standard loan equation - formula derived by induction
d = r s (1/((1 + r)^n - 1) + 1)
If your APR is quoted in the USA it will be a nominal rate. For a loan with monthly repayments and a "nominal APR compounded monthly" the periodic rate
r = APR/12
APR = 5% = 0.05 r = 0.05/12 = 0.00416667
If your APR is quoted in Europe it will be an effective annual rate. To convert to a periodic monthly rate
r = (1 + APR/100)^(1/12) - 1
APR = 5% = 0.05 r = (1 + 0.05)^(1/12) - 1 = 0.00407412
See Investopedia - Present Value of an Ordinary Annuity for more insight into how this is calculated.
For example, the Investopedia loan illustration, with 5 annual payments and APR of 5% (nominal compounded annually is the same as effective annual rate.)
Using the same example of five $1,000 payments made over a period of five years, here is how a present value calculation would look. It shows that $4,329.58, invested at 5% interest, would be sufficient to produce those five $1,000 payments.
s = 4329.58 r = 0.05 n = 5 d = r s (1/((1 + r)^n - 1) + 1) = 1000