about | help | code help+videos | done | prefs |
Write a method that returns the sum of all the integers from 'low' up to and including 'high', except do NOT include 'exclude' or any multiple of 'exclude'. As preconditions you may assume that 'low' is less than or equal to 'high' and that the sum will not exceed the maximum value that can be stored in an integer. You may also assume that all three parameters are positive numbers. For example, if 'low' is 2, 'high' is 7, and 'exclude' is 3 you would return an 18 since 2+4+5+7 = 18. (Note that 3 and 6 were NOT included in the sum since they are multiples of 3). Look at the test data for other examples. test2023_11_16_APP1SLHL_sumFromToExcluding(1, 100, 120) → 5050 test2023_11_16_APP1SLHL_sumFromToExcluding(5, 26, 8) → 293 test2023_11_16_APP1SLHL_sumFromToExcluding(10, 200, 13) → 18495 ...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: 220
Copyright Nick Parlante 2017 - privacy