C++: Make a function that adds all digits of an intusing recursion.
For example, if your function was named AddAllDigits andreturned an Int:
cout << AddAllDigits(1597); //should print 22, because 1 +5 + 9 + 7 = 22
The challenge here is using recursion: yourfunction must call itself multiple times and cannot use any loopswhatsoever. Also, no global variables allowed.
This question really stumped me. Thank you for your time!
Expert Answer
An answer will be send to you shortly. . . . .