Advertisement
Guest User

Untitled

a guest
Nov 21st, 2016
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Racket 0.37 KB | None | 0 0
  1. #lang racket
  2.  
  3. (define (invfact x i)
  4.   (define y (/ x i))
  5.   (cond
  6.     [(= y 1) x]
  7.     [(> y 1) (invfact y (+ i 1))]
  8.     [(< y 1) (error "Aucune factorielle possible")]))
  9.  
  10. (define (display_invfact n)
  11.   (printf "~a = ~a!\n" n (invfact n 2)))
  12.  
  13. (display_invfact 120)
  14. (display_invfact 3628800)
  15. (display_invfact 479001600)
  16. (display_invfact 6)
  17. (display_invfact 18)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement