For eg; if n = 2,
Then the output should be 10,11,...99 // (i.e) 10 to 99
if n = 3,
Output: 100,101...999 //note the 3 digit numbers are returned. The range would be 100 to 999.
How can i achieve this. Is there any formula to get the range.
For eg; if n = 2,
Then the output should be 10,11,...99 // (i.e) 10 to 99
if n = 3,
Output: 100,101...999 //note the 3 digit numbers are returned. The range would be 100 to 999.
How can i achieve this. Is there any formula to get the range.
The range $[a, b] \cap \mathbb N$ of numbers with $n$ digits is determined by $$\begin{align*} a &= 10^{n - 1}\\ b &= 10^n - 1. \end{align*}$$