VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Algorithm that calculates the Factorial of Numbers (N!) up to 170

by Data Mining Consultant (1 Submission)
Category: Math/Dates
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Thu 2nd May 2002
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Algorithm that calculates the Factorial of Numbers (N!) up to 170

Rate Algorithm that calculates the Factorial of Numbers (N!) up to 170



On Error GoTo ErrorHandler

'**********************************************************************************************************
'
'Purpose: Algorithm that calculates the Factorial of Numbers (N!) up to 170.
'
'Argument(s): N - long integer number less than 171.
'
'Source: http://www.paretoanalysts.com
'
'Author: Pareto Analysts
'
'Creation Date: December 1, 2001
'
'Description: Calculates the Factorial of a Number. N! can be computed as 'N*(N-1)*(N-2)...(N-(N-1))*2*1
' E.g. 5! = 5*4*3*2*1
'
'Return Value: The Factorial of the Number passed to it.
'
'Return Type: Double
'
'Limitation: The Largest Number that can be passed is 170 corresponding to '170!(7.25741561530799E+306)
'
'
'Warranty : No claim is made as to the accuracy or fitness of this algorithm. The use of this
' algorithm is at your own risk and choice and the author is not liable in anyway
' for its use or damages that may occur as a result of its use.
'
'Copyright: The use or distribution of this algorithm is free provided that it is
' used or distributed along with this header notice and this header notice
' has not been modified in any way. If this algorithm is used in a compiled form then
' the header notice must also be placed in a readme.txt file
'
'Inquiries: Inquiries about this algorithm, data mining, statistical analysis and data analysis
' can be directed to http://www.paretoanalysts.com
'
'*******************************************************************************

If N < 0 Then

Factorial = 0

ElseIf N = 0 Then

Factorial = 1

Else

Factorial = N * Factorial(N - 1)

End If



Exit_ErrorHandler:
Exit Function


ErrorHandler:
MsgBox Err.Number & " " & Err.Description, vbInformation, "www.paretoanalysts.com Factorial "
Resume Exit_ErrorHandler
End Function




Download this snippet    Add to My Saved Code

Algorithm that calculates the Factorial of Numbers (N!) up to 170 Comments

No comments have been posted about Algorithm that calculates the Factorial of Numbers (N!) up to 170. Why not be the first to post a comment about Algorithm that calculates the Factorial of Numbers (N!) up to 170.

Post your comment

Subject:
Message:
0/1000 characters