about | help | code help+videos | done | prefs |
oct23_2017_SLHL_sumIfFactor
Write a method that returns the sum of all the numbers in an input parameter array, except that numbers are ONLY included in the sum if thsy are a factor of the previous number in the array. The first number is always included in the sum, and the array will have at least one element. Look at the test data for examples. Note: 1 is a factor of every positive integer. oct23_2017_SLHL_sumIfFactor([5, 3, 700, 70, 10, 5, 2]) → 90 oct23_2017_SLHL_sumIfFactor([30, 15, 5, 1, 1]) → 52 oct23_2017_SLHL_sumIfFactor([800, 400, 200, 100, 50, 25, 5, 7, 3, 4]) → 1580 ...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