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

 

norm.krumpe@muohio.edu exam3section2 > stepsTo1000
prev  |  next  |  chance

How many times can you double a number until the result reaches or exceeds 1000? For example if you start with 3 and keep doubling, you will get 6, 12, 24, 48, 96, 192, 384, 768, 1536. It took 9 steps to reach or exceed 1000. Write a method that takes a starting value and returns the number of doubling steps it takes to reach or exceed 1000. The starting number will always be positive and less than 1000. The starting number will be greater than zero.


stepsTo1000(3) → 9
stepsTo1000(1) → 10
stepsTo1000(500) → 1

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

int stepsTo1000(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: 200

Copyright Nick Parlante 2017 - privacy