After prompting the user to enter a 5 digit number, output the number with each digit separated by three spaces.

So what's the problem. It is really very simple if you think about it in any language, something which you omitted to tell us. Stuart

The problem is I,m just starting "C" programming. And I'm lost.

Say your number is 59999; what two operators can you use so that you get a 5 along with a remainder of 9999 followed by a 9 with a remainder of 999 and so on? Hint:

// validate number is within the range of 10000-99999 while(number > 0) { ... // operator 1 ... // operator 2 }

The easiest way is to convert the number to a string and then do a bit of string replacement. Like most programming problems, there is usually more than one solution. It is up to you as the programmer to works which is best for the situation.

Stuart

Ask Your Question

Weekly Poll