about | help | code help+videos | done | prefs |
Write a method that returns the sum of the right-most two blocks of two digits of the input parameter 'a'. Ignore any digits that are not in the right-most two blocks of digits. As preconditions, you may assume that 'a' will be non-negative. The previous sentences are hard to understand unless you see some examples, so here are some examples: If 'a' is 5123 you would return 74. This is because the right-most block of two digits is 23 and the NEXT right-most block of two digits is 51. The sum of 23+51 is 74. If 'a' is 923124 you would return 55. This is because you would add 24+31 which equals 55. You would ignore the 92 because you are only supposed to use the right-most two blocks of two digits. test2024_10_31_APP1SLHL_sumBlockOfDigits(7) → 7 test2024_10_31_APP1SLHL_sumBlockOfDigits(823) → 31 test2024_10_31_APP1SLHL_sumBlockOfDigits(24) → 24 ...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: 230
Copyright Nick Parlante 2017 - privacy