0

I have to implement the following behavior using C#

I give a number, something like: 1 or 2 or 35 or 958 and starting from this number I have to build a string that is the concatenation of n 0 values followed by the given number.

The string lenght is fixed and is 7 character.

I will do some example to better explain my use case:

  • If the given number is 1 the build string will be: 0000001
  • If the given number is 37 the build string will be: 0000037
  • If the given number is 252 the build string will be: 0000252

and so on.

What could be a smart way to implement this behavior in C#?

AndreaNobili
  • 40,955
  • 107
  • 324
  • 596

0 Answers0