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

 

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

Write a method that returns the number of times that 'num' can be divided by 'div' before resulting in zero. For example, if you start with 'num'=50 and 'div'=4 the answer can be determined this way: 50/4=12 (because this is INTEGER division!) 12/4=3. 3/4=0. So there were 3 steps to get to zero, we therefore return 3. Preconditions: 'num' is non-negative. 'div' is greater than 1. Look at the test data for examples.


test2023_12_07_APP1SLHL_howManyTimes(50, 4) → 3
test2023_12_07_APP1SLHL_howManyTimes(12535, 3) → 9
test2023_12_07_APP1SLHL_howManyTimes(2589582, 2) → 22

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

public int test2023_12_07_APP1SLHL_howManyTimes(int num, int div) { }

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

Copyright Nick Parlante 2017 - privacy