Question: Mr. X has asked us to implement a very interesting function f(n,d). d denotes a digit between 0 to 9. Given a number n, we
Mr. X has asked us to implement a very interesting function f(n,d). d denotes a digit between 0 to 9. Given a number n, we need to print how many times d has occurred from the number 0 to n.
For example, f(12,1) is 5 because between 0 to 12, 1 occurs 5 times: 1, 10, 11, and 12.
Given an n and d, find out f(n,d) and print it.
Write programming code for the above in python
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
