I'm working to make a program which will subtract a pair of numbers until it reaches kaprekars constant.

in cases where the number is <1000, we are supposed to take the number and add a leading zero to it.

i.e 999 would become 0999.

I have a feeling this has something to do with the format specifiers, but I'm under the assumption that the leading zeros are not actually part of the number.

Am I totally barking up the wrong tree or am I close to what I need?

Here is my code for reference
Code:
```remainders = userInput % 1000;inputVariables[0] = userInput / 1000;
userInput = remainders;

remainders = userInput % 100;
inputVariables[1] = userInput / 100;
userInput = remainders;

remainders =userInput % 10;
inputVariables[2] = userInput / 10;
userInput = remainders;
inputVariables[3] = remainders;

numberY = (inputVariables[0]*(1))+(inputVariables[1]*(10))+(inputVariables[2]*(100))+(inputVariables[3]*(1000));

return numberY;```

2. Leading zeros are purely an artefact of how you decide to present the information to the user.

They have no mathematical significance at all.

Look at say "%04d" as a printf format for displaying numbers with leading zeros.

3. sounds like thats a dead end then. but i'm still clueless as to how I get numbers like 999 to be interpreted by the program as 0999.

4. You don't.

You can output a value 999 with a leading zero, using %04d format specifier. You can interpret input data of the form "0999" as the value 999.

However, the value 999 is represented using some unique (for your compiler) representation corresponding to its type (eg int, float, double). Typically that represents consists of a sequence of bits that are set on and off - changing any bit changes the value. But that representation does not vary with how the value is input or output.

5. The easiest way I can see is to convert the values to and from string form for some of the operations.

For instance, convert the number to a string, then add leading zeros (if necessary), reverse the string, then convert back to a number again.