Is Strong Number
This algorithm checks whether a given number is strong number or not. Strong numbers are the numbers whose sum of factorial of digits is equal to the original number.
Public Shared Function IsStrongNumber(number As Integer) As Boolean
Dim fact As Long
Dim num As Integer = number
Dim sum As Long = 0
While number <> 0
fact = 1
For i As Integer = 1 To number Mod 10
fact *= i
Next
sum += fact
number \= 10
End While
Return sum = num
End Function
Example
Dim _isStrongNumber = IsStrongNumber(145)
Output
True