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

 

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

Write a method that returns the sum of the integers in array 'nums', except that only numbers that are multiples of 'mult' count towards the sum. Look at the test data for examples. As preconditions you may assume there are no negative numbers in 'nums' and that 'mult' is positive.


test2022_01_20_APSLHL_sumMultiples([], 15) → 0
test2022_01_20_APSLHL_sumMultiples([], 2) → 0
test2022_01_20_APSLHL_sumMultiples([22, 11, 33, 55, 42, 64, 121, 222], 11) → 242

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

public int test2022_01_20_APSLHL_sumMultiples(int[] nums, int mult) { }

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

Copyright Nick Parlante 2017 - privacy