entering spaces between an outputed number

May 22, 2011 at 08:43:26
Specs: Windows 7
After prompting the user to enter a 5 digit number, output the number with each digit separated by three spaces.

See More: entering spaces between an outputed number

Report •


#1
May 22, 2011 at 08:53:58
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


Report •

#2
May 22, 2011 at 09:02:53
The problem is I,m just starting "C" programming. And I'm lost.

Report •

#3
May 22, 2011 at 13:27:40
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
}


Report •

Related Solutions

#4
May 22, 2011 at 13:51:21
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


Report •


Ask Question