The instructions say: Write a value-returning recursive function called DigitSum
ID: 3619553 • Letter: T
Question
The instructions say:Write a value-returning recursive function called DigitSum that computes the sum of the digits in a given positive int argument.
For example, if the argument is 12345, then the function returns: 1+2+3+4+5 = 15. I know that I'll need to Mod the number. For example: If the argument is 3852, 3852 %10 = 2 3852/10 385 %10 = 5 385/10 38 %20 = 8 38/10 3 %10 = 3 3/10 0 The instructions say:
Write a value-returning recursive function called DigitSum that computes the sum of the digits in a given positive int argument.
For example, if the argument is 12345, then the function returns: 1+2+3+4+5 = 15. I know that I'll need to Mod the number. For example: If the argument is 3852, 3852 %10 = 2 3852/10 385 %10 = 5 385/10 38 %20 = 8 38/10 3 %10 = 3 3/10 0
Explanation / Answer
please rate - thanks message me if you don't understamdRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.