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

 

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

Write a method that returns the sum of the integer in 'nums', but ONLY include that number in the sum if it is a multiple of the corresponding value in 'mults'. If none of the numbers are multiples of the corresponding values in 'mults' then return 0. As preconditions, you may assume that all integers in both arrays are positive AND that the arrays will be the same length. As always, look at the test data for further examples.


quiz2024_10_03_P1SLHL_arraySumMultOf([72, 21, 75, 194, 73], [7, 5, 11, 94, 11]) → 0
quiz2024_10_03_P1SLHL_arraySumMultOf([824, 59, 29, 34, 147, 4352, 7346], [81, 59, 29, 46, 2, 2, 3]) → 4440
quiz2024_10_03_P1SLHL_arraySumMultOf([68, 112, 7777, 81], [12, 4, 7, 8]) → 7889

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

public int quiz2024_10_03_P1SLHL_arraySumMultOf(int[] nums, int[] mults) { }

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

Copyright Nick Parlante 2017 - privacy