[Python]

*15.1 (Sum the digits in an integer using recursion) Write a recursive function that com- putes the sum of the digits in an i

*15.1 (Sum the digits in an integer using recursion) Write a recursive function that com- putes the sum of the digits in an integer. Use the following function header: def sumDigits(n): For example, sumDigits (234) returns 2 + 3 + 4 = 9. Write a test program that prompts the user to enter an integer and displays its sum.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *