Question: 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

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
1
2
3
4
5
your program must return
1
5
,
and for
4
5
6
3
2
it must return
2
0
.
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
1
2
3
4
5
.
Step
1
-
>
1
2
3
4
5
%
1
0
which is equal
-
too
5
+
(
send
1
2
3
4
5
1
0
to next step
)
Step
2
-
>
1
2
3
4
%
1
0
which is equal
-
too
4
+
(
send
1
2
3
4
1
0
to next step
)
Step
3
>
1
2
3
%
1
0
which is equal
-
too
3
+
(
send
1
2
3
1
0
to next step
)
Step
4
>
1
2
%
1
0
which is equal
-
too
2
+
(
send
1
2
1
0
to next step
)
Step
5
>
1
%
1
0
which is equal
-
too
1
+
(
send
1
1
0
to next step
)
Step
6
-
>
0

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!