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

 

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

Write a method that returns the number of times it takes to divide by successive integers using integer division, before you get a result of 0. You start by dividing 'num' by 2, then you divide that integer result by 3, then that result by 4, etc. Return the number of divisions of this type needed to get a result of 0. Look at the test data for examples. You MAY use recursion, but it is not required. If you do choose to use recursion, you should definitely use a helper method.


test2024_09_19_SLHL_steps(80) → 4
test2024_09_19_SLHL_steps(2) → 2
test2024_09_19_SLHL_steps(3) → 2

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

public int test2024_09_19_SLHL_steps(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: 240

Copyright Nick Parlante 2017 - privacy