(Sum the digits in an integer using recursion) Write a recursive function that computes the sum of the digits in an inte
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
(Sum the digits in an integer using recursion) Write a recursive function that computes the sum of the digits in an inte
(Sum the digits in an integer using recursion) Write a recursive function that computes the sum of the digits in an integer. Use the following function header: def sumDigits (n): For example, sumDigits (234) returns 9. Write a test program that prompts the user to enter an integer and displays the sum of its digits. Sample Run Enter an integer: 231498 The sum of digits in 231498 is 2 If you get a logical or runtime error, please refer
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!