Question: C++ Program Write a recursive function that computes the sum of the digits in an integer. Use the following function header int sumDigits(int number) For

C++ Program
 C++ Program Write a recursive function that computes the sum of

Write a recursive function that computes the sum of the digits in an integer. Use the following function header int sumDigits(int number) For example, sumDigits(234) returns the value 9 because 2 +3 +4-9 From main, test the function using a loop that repeatedly prompts the user to enter an integer and displays its sum. Do not allow the user to input negative integers, re-prompt if they do. The last digit (ones place) can be extracted by using the modulus operator. Then, you can remove the last digit by dividing. 54 % 10,4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!