about | help | code help+videos | done | prefs |
Write a method that returns the "Funky Sum" of a number. The "Funky Sum" of a number is the sum of all the digits in that number, with the EVEN digits counting as positive values but the ODD digits counting as negative values. It is not about the position of the digits, but rather the even or oddness of the digit that matters. You MUST solve this problem USING RECURSION in a meaningful way. No loops of any kind are allowed! As a precondition, you may assume that 'num' is non-negative. For example, the "Funky Sum" of 64325 is 4 because 6+4-3+2-5=4. Look at the test data for more examples. Remember, RECURSION is REQUIRED. You may also use one or more helper methods. Remember to make sure each method has only one return statement. test2024_03_12_SLHL_funkySum(0) → 0 test2024_03_12_SLHL_funkySum(5) → -5 test2024_03_12_SLHL_funkySum(2378) → 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: 410
Copyright Nick Parlante 2017 - privacy