Post Reply 
HP Prime: Length of a Loan with a Certain Payment
03-26-2018, 01:49 PM (This post was last modified: 09-22-2018 11:51 PM by Eddie W. Shore.)
Post: #1
HP Prime: Length of a Loan with a Certain Payment
Introduction

The program PMTLENGTH will calculate how many payments that are required to finish a loan, given a certain annual interest rate and payment. Payments are assumed to be monthly, and end of period. The program will also return the last payment. Due to the rounding in the financial algorithms, the last payment is an approximate (unless the interest rate is 0%).

Input: PMTLENGTH(I,P,X)
I = annual interest rate
P = loan amount
X = payment amount, enter as a negative amount

Firmware 13441 or later is required.


HP Prime Program PMTLENGTH

Code:
EXPORT PMTLENGTH(I,P,X)
BEGIN
// I%YR, PV, PMT (as negative)
// 2018-03-19 EWS
// how many monthly payments?
// last payment? (FV)

LOCAL N,B;

N:=Finance.TvmNbPmt(I,P,X,0,12);
B:=P;
IF FP(N)≠0 THEN
B:=Finance.TvmFV(IP(N),I,P,X,12);
N:=IP(N)+1;
END;

// {N, final pmt}
RETURN {N,B};
END;

Examples

Example 1: How long will I take to pay off a $2,000 loan if I make $600 payments each month? This is a no interest loan.

Result: {4, -200}

It will take 4 payments, with the last payment being $200.

Example 2: How long will I take to pay off a $5,350 loan if I make $750 monthly payments each month? The loan has a 10% monthly interest rate.

Result: {8, -286.906502677}

It will take 8 payments, with the last payment being about $286.91.
Visit this user's website Find all posts by this user
Quote this message in a reply
07-28-2018, 08:27 PM
Post: #2
RE: HP Prime: Length of a Loan with a Certain Payment
Thanks a lot for this useful program.

I’m a new hp prime user and it’s a good example on how financial functions works.

Guy R. KOMAN, hp 50G, hp Prime Rev. C
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)