Skip to content

Latest commit

 

History

History
18 lines (12 loc) · 428 Bytes

Simple and compound interest algorithm.md

File metadata and controls

18 lines (12 loc) · 428 Bytes

[[Additional Algorithms]]

This is a simple and compound interest algorithm, provided that we have the time, initial deposit and interest rate given.

function interest(P,r,n) { let simpleInterest=P+Prn let compoundInterest=P; for(let i=0;i<n;i++){ compoundInterest+=compoundInterest*/r } return [Math.round(simpleInterest),Math.round(compoundInterest)] }

/ is used to escape the asterisk

#algorithms