Question: SECTION 2 : ( 5 POINTS ) In this section you will be given a number with some digits and then we need to find

SECTION 2: (5 POINTS)
In this section you will be given a number with some digits and then we need to find sum of
its digits using recursion. For example, for 12345 your program must return 15, and for
45632 it must return 20.
To give you a hint here is the step-by-step process for a better understanding of how the
algorithm works.
Let the number be 12345.
Step 1->12345%10 which is equal-too 5+( send 12345/10 to next step )
Step 2->1234%10 which is equal-too 4+( send 1234/10 to next step )
Step 3->123%10 which is equal-too 3+( send 123/10 to next step )
Step 4->12%10 which is equal-too 2+( send 12/10 to next step )
Step 5->1%10 which is equal-too 1+( send 1/10 to next step )
Step 6->0 algorithm stops.

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!