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

 

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

Write a method that has an integer parameter. As a precondition, you may assume that this integer parameter will be a 3-digit positive number. Return the sum of the digits of that number. Look at the test data for examples.


test2024_10_08_P1SLHL_sumDigits(782) → 17
test2024_10_08_P1SLHL_sumDigits(111) → 3
test2024_10_08_P1SLHL_sumDigits(123) → 6

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

public int test2024_10_08_P1SLHL_sumDigits(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: 250

Copyright Nick Parlante 2017 - privacy