about | help | code help+videos | done | prefs |
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', but this time it doesn't stop until that sum is a single digit. For example, funnyHatNumsAdvanced(99) returns 9 since 9+9=18. Look at the test data for further examples. Please note: NO STRING METHODS ARE ALLOWED in your solution! You MAY do this recursively but it is not required. Also, you MAY use a helper method. funnyHatNumsAdvanced2(427482) → 9 funnyHatNumsAdvanced2(42984421) → 7 funnyHatNumsAdvanced2(98214789) → 3 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 290
Copyright Nick Parlante 2017 - privacy