countPositive 5 marksSolutionGiven a number d representing t

countPositive (5 marks)

Solution

Given a number d, representing the number of digits of a number. Find the total count of positive integers which have at-least one zero in them and consist d or less digits.

Examples:

Input : d = 1

Output : 0

There\'s no natural number of 1 digit that contains a zero.

Input : d = 2

Output : 9

Input : d = 3

Output : 180

For d = 3, we\'ve to count numbers from 1 to 999, that have

atleast one zero in them.

Similarly for d=4, we\'d check every number from 1 to 9999.

countPositive (5 marks)SolutionGiven a number d, representing the number of digits of a number. Find the total count of positive integers which have at-least on

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site