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

 

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

Write a method that returns the sum of the numbers in 'nums' but ONLY including numbers that have a remainder of 'remain' when divided by 'div'. For example, if 'nums' is {6,14,21,24}, 'div' is 5, and 'remain' is 1, you would return 27 (the sum of 6 plus 21). NOTE: You may assume that none of the integers passed in as parameter are negative. Look at the test data for additional examples.


test2023_09_08_SLHL_([28, 40, 55, 152], 10, 8) → 28
test2023_09_08_SLHL_([5, 10, 15, 20, 25, 30, 35, 40, 45], 10, 0) → 100
test2023_09_08_SLHL_([5, 10, 15, 20, 25, 30, 35, 40, 45], 5, 0) → 225

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

public int test2023_09_08_SLHL_(int[] nums, int div, int remain) { }

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

Copyright Nick Parlante 2017 - privacy