about | help | code help+videos | done | prefs |
Write a method that returns the number of times 'digit' appears in 'num'. As preconditions you may assume that 'num' is positive and that 'digit' is a single non-negative digit (but could be zero). You are NOT allowed to use arrays or strings in solving this problem! Recursion IS allowed, but not required. test2024_01_22_APP1SLHL_countDigits(70000, 0) → 4 test2024_01_22_APP1SLHL_countDigits(40010, 0) → 3 test2024_01_22_APP1SLHL_countDigits(12535, 5) → 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: 245
Copyright Nick Parlante 2017 - privacy