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

 

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

Write a method that returns the sum of all the integer values in 'nums' that have values between 'low' and 'high' inclusive. For example, if 'nums' is {5,12,3,17,22,9,15}, 'low' is 15, and 'high' is 20, you would return 32 since only 15 and 17 are between 'low' and 'high' inclusive. As preconditions you may assume that low<=high. Look at the test data for additional examples.


test2024_12_12_APP1SLHL_addBetween([352], 300, 400) → 352
test2024_12_12_APP1SLHL_addBetween([5, 12, 3, 17, 22, 9, 15], 15, 20) → 32
test2024_12_12_APP1SLHL_addBetween([-325, -23, 235, -35, -3526, -9182, -5, 2414, 325, 977, 0], -8000, -8) → -3909

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

public int test2024_12_12_APP1SLHL_addBetween(int[] nums, int low, int high) { }

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

Copyright Nick Parlante 2017 - privacy