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

 

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

Write a RECURSIVE method that accepts a non-negative integer parameter and returns the sum of the digits in that number. Your solution MUST be RECURSIVE in a non-trivial way.


recursiveSumDigits(412812) → 18
recursiveSumDigits(2142) → 9
recursiveSumDigits(92184) → 24

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

public int recursiveSumDigits(int num) { }

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

Copyright Nick Parlante 2017 - privacy