In some cases, we require to generate a fixed length number. If the length of the number is less than the required length, then left side of the number should be filled with 0. For example, we want to generate the numbers, whose length must be 8 and if the length of any number is less than 8, left side of the number should be filled with 0.
For example.
1=00000001
11=00000011
111=00000111
1111=00001111
11111=00011111
111111=00111111
1111111=01111111
11111111=11111111
Now, we will learn, how can we generate such a number.