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

 

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

Write a method that has an input parameter called 'num' which is a non-negative integer. The method returns the sum of the digits in 'num'. For example, funnyHatNumsAdvanced(53) returns 8 since 5+3=8. Look at the test data for further examples. Please note: NO STRING METHODS ARE ALLOWED in your solution!


funnyHatNumsAdvanced(98214789) → 48
funnyHatNumsAdvanced(95969) → 38
funnyHatNumsAdvanced(214) → 7

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

public int funnyHatNumsAdvanced(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