Files
pplus-library/pseudo/programs/03-compound-interest.pseudo
T
alexm 568474d52f
Test (in pplus-core) / in-core (push) Failing after 28m44s
Initial commit
2026-11-12 22:23:48 -05:00

12 lines
367 B
Plaintext

// Finance flavor: a loop that updates a FLOAT, with ROUND for reporting.
// EXPECT: 1628.89
FUNCTION BALANCE_AFTER(Principal : FLOAT, Rate : FLOAT, Years : INTEGER) RETURNS FLOAT
DECLARE B : FLOAT
B <- Principal
FOR Y <- 0 TO Years
B <- B * (1 + Rate)
NEXT Y
RETURN B
ENDFUNCTION
OUTPUT ROUND(BALANCE_AFTER(1000.0, 0.05, 10) * 100) / 100