Question
Consider the following recursive implementation to find the sum of digits of number:#includeint recursive_sum_of_digits(int n){ if(n == 0) return 0; return _________;}int main(){ int n = 1201; int ans = recursive_sum_of_digits(n); printf("%d",ans); return 0;}Which of the following lines should be inserted to complete the above code?
Answer: Option C
Was this answer helpful ?
The line "(n % 10) + recursive_sum_of_digits(n / 10) should be inserted to complete the above code.
Was this answer helpful ?
Submit Solution