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

 

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

Write a method that figures out what 'jump' is needed get the given 'sum'. The 'sum' must be the sum of all the integers starting at 'first' going up to and possibly including 'max' (but without going over) by going up by 'jump' each time. For example, if 'first' is 8, 'max' is 22, and 'sum' is 56 you will return a 4. The reason is that 8+12+16+20=56, so you can get the 'sum' of 56 by going up by 4 each time. Preconditions: All parameters are positive. It will be possible to find a value for 'jump' to get the given 'sum' from the other given information.


test2022_11_17_P1SLHL_maxJump(8, 22, 56) → 4
test2022_11_17_P1SLHL_maxJump(6, 20, 26) → 14
test2022_11_17_P1SLHL_maxJump(1, 100, 5050) → 1

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

public int test2022_11_17_P1SLHL_maxJump(int first, int max, int sum) { }

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