about | help | code help+videos | done | prefs |
test2021_04_22_APP1SLHL_someDigitsSum
Write a method that returns the sum of certain digits in 'num'. If 'even' is true, return the sum of the EVEN digits in 'num'. If 'even' is false, return the sum of the ODD digitis in 'num'. As a precondition, you may assume that 'num' is positive. test2021_04_22_APP1SLHL_someDigitsSum(124523, true) → 8 test2021_04_22_APP1SLHL_someDigitsSum(62882, true) → 26 test2021_04_22_APP1SLHL_someDigitsSum(32833, false) → 9 ...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