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

 

sumDigits


Return the sum of the digits in the positive integer n.


sumDigits(123) → 6
sumDigits(0) → 0
sumDigits(10101) → 3

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

public int sumDigits(int n) { }

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

Copyright Nick Parlante 2017 - privacy