Code archives/Miscellaneous/! (Factorial) Finder
This code has been declared by its author to be Public Domain code.
Download source code
| This finds n! http://www.cut-the-knot.org/do_you_know/permutation.shtml tells you more about what a factorial is. Basically 5! is 5*4*3*2(*1) Simple but does the job. |
Print Fact%(0) WaitKey() End Function Fact%(Num) Perms = Num For a = 1 To Num - 1 Perms = Perms * (Num - a) Next If Num = 0 Then Return 1 Else Return Perms EndIf End Function |
Comments