Friday, November 19, 2010

VBScript Code - Factorial Function

Write the below code in a notepad and save it as a .vbs file. Either run it from command prompt or run it by double-clicking on it.

VBScript Code - Factorial Function

Function Factorial(a)
x=1
For i=1 to a
  x=x*i
next 
Factorial=x
End Function

Msgbox Factorial(5)