about | help | code help+videos | done | prefs |
Write a method that returns the sum of the two integer parameters, 'a' and 'b', but ONLY include a number in the sum if it is a multiple of 'mult'. For example, with the parameters (20,25,5) you would return 45 because both 20 and 25 are multiples of 5 and the sum of 20+25=45. However, with the parameters (21,15,7) you would only return 21. Since 15 is not a multiple of 7 you would not include it in the sum. If neither number is a multiple of 'mult' then return 0. As preconditions, you may assume that all parameters are positive. As always, look at the test data for further examples. quiz2024_10_03_APP1SLHL_sumMultOf(808, 404, 7) → 0 quiz2024_10_03_APP1SLHL_sumMultOf(40, 70, 10) → 110 quiz2024_10_03_APP1SLHL_sumMultOf(39, 71, 10) → 0 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 250
Copyright Nick Parlante 2017 - privacy