Create a recursive function


Discuss the below:

Q: Create a recursive function "sumDigits" in C++, that receives an integer as argument by reference and returns the sum of digits representing this integer. Also write a main function to test this function.

Example output of program should look like following.

Enter a nonnegative integer: 23
The sum of the digits of 23 is 5

 

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Create a recursive function
Reference No:- TGS01937043

Now Priced at $20 (50% Discount)

Recommended (91%)

Rated (4.3/5)