about | help | code help+videos | done | prefs |
Write a method that returns the "Strange Digit Sum" of a positive integer. This sum is found by adding the digits of the number, but also adding the amount of the decimal position of that digit. For example, the strange digit sum of 421 is 118 because 1+1 + 2+10 + 4+100 = 118. The 1 is in the 1's place, the 2 is in the 10's place, and the 4 is in the 100's place. So you add the digit and its decimal place, then do that for all of the digits. You are NOT allowed to use any string methods in solving this problem. Recursion would be cool, but is not required. ggg2StrangeDigitSum(5893223) → 1111143 ggg2StrangeDigitSum(2434) → 1124 ggg2StrangeDigitSum(1) → 2 ...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