Count the Digit

Write a function count_digit(d,n)count\_digit(d, n) that receives a single digit dd (non-negative integer less than 10) and a positive integer nn and returns the number of occurrences of digit dd in nn.

Observation

All integers are assumed written in the usual base 10.

Problem information

Author: Jordi Delgado & José Luis Balcázar

Generation: 2026-01-25T15:56:51.601Z

© Jutge.org, 2006–2026.
https://jutge.org