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

 

Factorial n!

The factorial of a positive integer n (IN(n)), denoted by n!, is the product of all natural integers less than or equal to n.

; n!=1*2*3 ... *n

(define (ncalc k myvalue)
 (if (> k 0)
  (ncalc (- k 1) (* myvalue k))
  myvalue
))

(define (n! k) (ncalc k 1))

(n! 2)
;Value: 2

(n! 5)
;Value: 120

 

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

zurück

 

     

Startseite | Impressum | Datenschutz