about | help | code help+videos | done | prefs |
Write a RECURSIVE method that returns the sum of all the digits in 'num', except do not include the digit 'exclude' in the sum. As preconditions you may assume that 'num' is non-negative and that 'exclude' is a single positive digit. For example, if 'num' is 17211 and 'exclude' is 1, you would return 9. Your solution MUST be recursive! sumDigitsExclude(895238, 1) → 35 sumDigitsExclude(19, 3) → 10 sumDigitsExclude(531, 2) → 9 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 320
Copyright Nick Parlante 2017 - privacy