Skip to content

Instantly share code, notes, and snippets.

@nhusher
Created December 31, 2014 18:31
Show Gist options
  • Save nhusher/f865624832a6da82da06 to your computer and use it in GitHub Desktop.
Save nhusher/f865624832a6da82da06 to your computer and use it in GitHub Desktop.
(defn loan-payment [ principal monthly-interest months ]
(float
(max 0
(if (zero? monthly-interest)
(/ principal months)
(* principal
(/ monthly-interest
(- 1 (Math/pow
(+ 1 monthly-interest)
(- months)))))))))
(loan-payment 18000 0.0164 60)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment