Simple recursive function that will help people wanting to learn recursion.
Simple recursive function that will help people wanting to learn recursion.
Rate Simple recursive function that will help people wanting to learn recursion.
(1(1 Vote))
'becomes a single number between 0 and 9,e.g., 1234=1+2+3+4=10=1
Private Function ReX(ByVal AnyStr As String) As String
Dim n As Integer, i As Integer
For i = 1 To Len(AnyStr)
n = n + Val(Mid(AnyStr, i, 1))
Next
If Len(Str(n)) > 2 Then n = Val(ReX(Str(n)))
ReX = Right(Str(n), 1)
End Function
Simple recursive function that will help people wanting to learn recursion. Comments
No comments yet — be the first to post one!
Post a Comment