id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > test2024_10_31_APP1SLHL_sumBlockOfDigits
prev  |  next  |  chance

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)

public int test2024_10_31_APP1SLHL_sumBlockOfDigits(int a) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 230

Copyright Nick Parlante 2017 - privacy