Page 165 - Learn to Program - Basic-256
P. 165

Chapter 10: Functions and Subroutines – Reusing Code.                           Page 149



                                     1! is 1
                                     2! is 2
                                     3! is 6
                                     4! is 24
                                     5! is 120
                                     6! is 720
                                     7! is 5040
                                     8! is 40320
                                     9! is 362880
                                     10! is 3628800

                              4. A recursive function is a special type of function that calls itself.
                              Knowing that n! = n * (n-1)! and that 0! = 1 rewrite #3 to use a
                              recursive function to calculate a factorial.












































                                                           © 2019 James M. Reneau (CC BY-NC-SA 3.0 US)
   160   161   162   163   164   165   166   167   168   169   170