Musings of a Gotham City Geek

What is the sound of one blog clapping?

 

Revenge of the Monochrome Turtle

n!=n*(n-1 )*(n-2)* … *4*3*2*11 l if n greater than 0; 1 if n=0

The recursive definition of n! is derived by noting that if n greater than 0, n!=n*(n-1)! and if n=0, n!1. In Logo this becomes

TO FACTORIAL :N IF :N = 0 OUTPUT 1 OUTPUT:N * FACTORIAL(:N-1) E N D

  1. oddlyzen posted this

Blog comments powered by Disqus