# Separating the digits of given number

Printable View

• 09-09-2010, 03:55 AM
lb2
Separating the digits of given number
Hi everyone,
I am trying to write a program which inputs one number consisting of five digits, then that number is being separated into individual digits separated each by (for example) 5 positions and prints out the newly separated number. For instance, if the user types in 12345 the program displays 1 2 3 4 5.
I am using java.util.Scanner but the tricky part is the separating of the actual digits.
Any ideas are greatly appreciated.

Thanks in advance,
LB

P.S. The number is typed in by the user using Scanner class.
• 09-09-2010, 04:11 AM
curmudgeon
Quote:

Originally Posted by lb2
Hi everyone,
I am trying to write a program which inputs one number consisting of five digits, then that number is being separated into individual digits separated each by (for example) 5 positions and prints out the newly separated number. For instance, if the user types in 12345 the program displays 1 2 3 4 5.
I am using java.util.Scanner but the tricky part is the separating of the actual digits.
Any ideas are greatly appreciated.

Thanks in advance,
LB

P.S. The number is typed in by the user using Scanner class.

Are you going to tell the volunteers here that you've already asked this question elsewhere? New To Java - Separating digits of given number That you've already received decent instruction on what to do? Or do you not care if they waste time duplicating work that's already been done?
• 09-09-2010, 04:30 AM
lb2
Hmm. I guess that same topic in the other forum is posted by my buddy :) We are in the same class and probably working on the same problem at the same time.
I am sorry for this kind of double posting. Please, disregard this post everyone. I am going to check the other forum.
• 09-09-2010, 04:41 AM
curmudgeon
Quote:

Originally Posted by lb2
Hmm. I guess that same topic in the other forum is posted by my buddy :) We are in the same class and probably working on the same problem at the same time.
I am sorry for this kind of double posting. Please, disregard this post everyone. I am going to check the other forum.

It's an amazing coincidence that your question and your "buddy's" are exactly the same. I mean word-for-word. What do you take us for?
• 09-09-2010, 04:46 AM
Eranga
Quote:

Originally Posted by curmudgeon
It's an amazing coincidence that your question and your "buddy's" are exactly the same. I mean word-for-word. What do you take us for?

Amazing ha. Could be cross-posting.
• 09-09-2010, 05:29 AM
curmudgeon
Quote:

Originally Posted by Eranga
Amazing ha. Could be cross-posting.

Yep, that's my conclusion, that it's likely the same guy cross-posting.