about | help | code help+videos | done | prefs |
Write a method that returns the "distilled" version of an integer parameter. "Distilling" a number involves the following process: Start with a positive integer. Divide that number by the sum of its digits, keeping the integer part of the result. Continue this process until the result is less than 100, or until the result is the same as the number than came before it. For example, when you divide 1000 by the sum of its digits you get 1000, so that is the distilled version of the number. Note that an input parameter that is already less than 100 will just be returned as the result. distilNum(324879) → 26 distilNum(1248941) → 23 distilNum(10000) → 10000 ...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: 430
Copyright Nick Parlante 2017 - privacy