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

 

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

Write a RECURSIVE method that returns the "digit double" of a non-negative integer. The "digit double" of a number is based on the original number having each digit doubled, provided that doubling the digit does not require carrying any part of the value to the next place-value. For example, the digit '3' can be doubled to make a '6', but the digit '7' will NOT get doubled, because the result would be 14 which would require carrying a '1' to the next higher place-value. For example, the number 120749 becomes 240789. Look at the test data for additional examples. Your solution MUST be recursive and you may NOT use any strings, chars, or loops. I suggest making a helper method just so your code is not so long when you make the recursive call to the method.


may_14_2019_APSLHL_digitDouble(31) → 62
may_14_2019_APSLHL_digitDouble(342) → 684
may_14_2019_APSLHL_digitDouble(7) → 7

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

public int may_14_2019_APSLHL_digitDouble(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: 440

Copyright Nick Parlante 2017 - privacy