id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > sumDigitsExclude
prev  |  next  |  chance

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)

public int sumDigitsExclude(int num, int exclude) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 320

Copyright Nick Parlante 2017 - privacy