about | help | code help+videos | done | prefs |
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) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 230
Copyright Nick Parlante 2017 - privacy