Question: Dont modify the code just insert the correct code where needed. pls In the following program, the code for function recursive_sum_of_digits is missing. This function

In the following program, the code for function recursive_sum_of_digits is missing. This function should return the sum of the digits of number n recursively until it becomes a single digit number Examples: Example 1: Input: n=56 Output: 2 Explanation: the sum of digits of 56 is 5+6-11. Since 11 is not a single digit number, we need to compute the sum of digits for 11, which is 2 (1+1=2). Now, we have a single digit number 2. Therefore, this function retums 2. Example 2: Input: 8 Output: 8 Explanation: 8 is already a single digit number. Therefore this functions return 8. Example 3: Input: 7777 Output: 1 Explanation: the number of digits of 7777 is 7+7+7+7-28. Since 28 in not a single digit number, we need to compute the sum of digits for 28, which is 10 (2-8-10). Since 10 is not a single digit number, we need to compute the sum of digits for 10, which is 1 (1+0). Now we have a single digit number 1. Therefore, this function returns 1. Implement the function on your computer. You are NOT allowed to modify any other parts of the program. Submit the following: 1. The code inside recursive sum of digits function. (80%) 2. The output of your program. (20%) #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
