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

 

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

Write a method that returns the sum of the digits in the one's place of 'a' and the one's place of 'b'. For example, if a=2417 and b=93251 you would return 8 since 7+1=8. The 7 was taken from the one's place of a, while the 1 was taken from the one's place of b. Look at the test data for further examples. Don't forget about "mod", which is the "%" operator. As a precondition, you may assume that a>0 and b>0. NOTE: NO strings are allowed! You may NOT use strings to solve this problem.


test2021_10_07_APSLHL_sumOnesPlace(1200435, 17424412) → 7
test2021_10_07_APSLHL_sumOnesPlace(8932715, 98347300) → 5
test2021_10_07_APSLHL_sumOnesPlace(3948101, 2893579) → 10

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

public int test2021_10_07_APSLHL_sumOnesPlace(int a, int b) { }

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: 210

Copyright Nick Parlante 2017 - privacy