about | help | code help+videos | done | prefs |
Write a method that returns the sum of the digits in the specific place value of parameters 'a' and 'b' as indicated by 'place'. As preconditions you may assume that a>=0, b>=0, and that 'place' is a non-negative power of 10 (1, 10, 100, 1000, etc.). For example, if place=100 that means you are to return the sum of the digits in the 100's place of 'a' and 'b'. If place=1000 you return the sum of the digits in the 1000's place. As an additional precondition, you may assume that 'a'>='place' and that 'b'>='place'. test2023_01_19_P1SLHL_digitSum(100, 1457, 5464778) → 11 test2023_01_19_P1SLHL_digitSum(100000, 54678991, 156478832) → 10 test2023_01_19_P1SLHL_digitSum(100, 457, 321) → 7 ...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: 240
Copyright Nick Parlante 2017 - privacy