Factorial in Basic
Example for versions
VBScript 5.7,
VBScript 5.8
This example shows iterative factorial calculation. Note that no overflow happens, though the type of factorial variable is inferred from its usage and never set explicitly.
f = 1
For i = 0 To 16
WScript.Echo(i & "! = " & f)
f = f * (i + 1)
Next
Comments
]]>blog comments powered by Disqus
]]>