programming-examples/asp/More_Code_Snippets/Factorial function.asp

17 lines
379 B
Plaintext
Raw Normal View History

2019-11-18 14:25:58 +01:00
<%
Function Factorial(ByVal intNumber)
If intNumber <= 1 Then
Factorial = 1
Else
Factorial = intNumber * Factorial(intNumber - 1)
End If
End Function
%>
And here we test the function with 2 values 5 and then 10
<%
Response.Write ("Factorial of 5 is " & Factorial(5))
Response.Write ("<br>")
Response.Write ("Factorial of 7 is " & Factorial(7))
%>