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_P1SLHL_sumAllBlocksOfDigits
prev  |  next  |  chance

Write a method that returns the sum of ALL the two block groups of two digits of the input parameter 'a', starting with the right-most block. 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 147. This is because you would add 24+31+92 which equals 147. You have to add ALL the two block groups of digits.


test2024_10_31_P1SLHL_sumAllBlocksOfDigits(923124) → 147
test2024_10_31_P1SLHL_sumAllBlocksOfDigits(1457) → 71
test2024_10_31_P1SLHL_sumAllBlocksOfDigits(5932) → 91

...Save, Compile, Run (ctrl-enter)

public int test2024_10_31_P1SLHL_sumAllBlocksOfDigits(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: 290

Copyright Nick Parlante 2017 - privacy