id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

jebbert@volusia.k12.fl.us > smaugCountMatchingDigitsAdvanced2
prev  |  next  |  chance

You may NOT use any strings or string methods for this problem. Write a method that returns the number of times a particular digit appears in a non-negative integer. Paramber 'num' will be the non-negative integer. Parameter 'digit' will be the digit to count. As a precondition, num>=0 and 0<=digit<=9.


smaugCountMatchingDigitsAdvanced2(531124, 1) → 2
smaugCountMatchingDigitsAdvanced2(265498121, 1) → 2
smaugCountMatchingDigitsAdvanced2(24982, 4) → 1

...Save, Compile, Run (ctrl-enter)

public int smaugCountMatchingDigitsAdvanced2(int num, int digit) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 290

Copyright Nick Parlante 2017 - privacy