by Muhammad Abubakar (6 Submissions)
Category: String Manipulation
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Wed 22nd September 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Simple recursive function that will help people wanting to learn recursion.
'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
No comments have been posted about Simple recursive function that will help people wanting to learn recursion.. Why not be the first to post a comment about Simple recursive function that will help people wanting to learn recursion..