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

 

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

Write a recursive method that returns the sum of each digit times 'mult'. For example, if 'num'=307 and 'mult'=4, the result would be equivalent to 3*4+0*4+7*4=12+0+28=40 so 40 would be returned. However, you MUST solve it recursively!


feb27_2018_HL_recursiveDigitSum(45, 1) → 9
feb27_2018_HL_recursiveDigitSum(1300702, 1) → 13
feb27_2018_HL_recursiveDigitSum(1507, 6) → 78

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

public int feb27_2018_HL_recursiveDigitSum(int num, int mult) { }

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

Copyright Nick Parlante 2017 - privacy