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

 

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

Write a method that has an integer input parameter. Return the "FINAL plus-one product of the digits" which means to multiply, not the digits of the number, but one more than each digit in the number. But then take that result and find the "plus-one product of the digits" again and again until you get a single-digit answer, or until the answer comes out the same each time. For example, prodDigOneFinal(25) returns 18 since 3 (2 plus 1) time 6 (5 plus one) is 18, but then that would just give 18 again and again. Here is another example: prodDigOne(2143243) comes out to 7200, but then prodDigOne(7200) is 24, then prodDigOne(24) is 15, then prodDig(15) is 12, and finally prodDig(12) is 6. So prodDigOneFinal(2143243) returns 6.


prodDigOneFinal(25) → 18
prodDigOneFinal(0) → 1
prodDigOneFinal(5) → 6

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

public int prodDigOneFinal(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: 390

Copyright Nick Parlante 2017 - privacy