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

 

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

Write a method that returns the sum of alternating digits in the non-negative input parameter, starting with the one's place. For example, the input 32915 will return 17 since 5+9+3=17. You are not allowed to use any string manipulation of any kind in solving this problem! Hint: Remember div and mod???


cedarAddAlternatingDigits(6) → 6
cedarAddAlternatingDigits(7) → 7
cedarAddAlternatingDigits(0) → 0

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

public int cedarAddAlternatingDigits(int num) { }

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