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

 

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

Write a method that returns the sum of the digits of every other digit in the number starting with the ones place, then skipping to the hundreds place (if present), then skipping to the ten-thousands place (if present), and so on. Your solution MUST be recursive and MUST be generalized (meaning you cannot use a whole bunch of conditional special-cases). As a precondition, the input parameter must be non-negative.


poolRAltDigSum(3) → 3
poolRAltDigSum(1) → 1
poolRAltDigSum(0) → 0

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

public int poolRAltDigSum(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: 330

Copyright Nick Parlante 2017 - privacy