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

 

addDigits


Given a string containing a mix of letters and digits, return a sum of the digits. Tip: Character.isDigit('5') will return true because 5 is a digit.


addDigits("ab1c2") → 3
addDigits("45") → 9
addDigits("xxx8x9x10") → 18

...Save, Compile, Run (ctrl-enter)

int addDigits(String str) { }

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: 250

Copyright Nick Parlante 2017 - privacy