If you do not use logarithmus, you will be getting overflow error for factorial of integers larger then approx. 280.
This is VB6 code:
Dim l As Long
Dim res As Double
For l = 1 To total
res = res + Log(CDbl(l))
Next
The final result "res" is used for furhter mathematical operation, rather then directly printing its value val= Exp(res), since if val is too high, you would just get the overflow error.