zurück   Startseite   Blog Buchregal Buchregal, eBooks Twitter E-Mail

 

Compound Interest

(define (compoundinterest found rate period)

  (if (= period 0)
      #t
      (begin
    (display "; Year #")
    (display period)
    (display ":")
    (display "compound interest: ")
    (display (* (/ (* found rate) 100) 1.0))
    (display " - ")
    (display "found: ")
    (display (* (+ found (/ (* found rate) 100)) 1.0))
    (newline)
     (compoundinterest (+ found (/ (* found rate) 100)) rate (- period 1))

))
)


(compoundinterest 100 19 4)
; Year #4:compound interest: 19. - found: 119.
; Year #3:compound interest: 22.61 - found: 141.61
; Year #2:compound interest: 26.9059 - found: 168.5159
; Year #1:compound interest: 32.018021 - found: 200.533921
;Value: #t


Exponentially function.

 

 

25. März 2019     | mit scheme | scheme | lisp | old data

zurück

 

     

Startseite | Impressum | Datenschutz