Question: ( 1 2 % ) Write a recursive function int sumDigits ( int x ) ; that returns the sum of all the digits in

(12%) Write a recursive function int sumDigits (int x); that returns the sum of all the digits in x. You can assume that x cannot be negative. E.g., the calls sumDigits (124) and sumDigits (79682) shall return 1+2+4=7 and 7+9+6+8+2=32 respectively. You are not allowed to use any for-loop, while-loop, or do-while-loop in this question.
( 1 2 % ) Write a recursive function int

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 Finance Questions!