Results 1 to 6 of 6
  1. #1
    lb2
    lb2 is offline Member
    Join Date
    Sep 2010
    Posts
    2
    Rep Power
    0

    Unhappy 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.
    Last edited by lb2; 09-09-2010 at 04:00 AM.

  2. #2
    curmudgeon is offline Senior Member
    Join Date
    May 2010
    Posts
    436
    Rep Power
    5

    Default

    Quote Originally Posted by lb2 View Post
    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?

  3. #3
    lb2
    lb2 is offline Member
    Join Date
    Sep 2010
    Posts
    2
    Rep Power
    0

    Default

    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.

  4. #4
    curmudgeon is offline Senior Member
    Join Date
    May 2010
    Posts
    436
    Rep Power
    5

    Default

    Quote Originally Posted by lb2 View Post
    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?

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Quote Originally Posted by curmudgeon View Post
    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.

  6. #6
    curmudgeon is offline Senior Member
    Join Date
    May 2010
    Posts
    436
    Rep Power
    5

    Default

    Quote Originally Posted by Eranga View Post
    Amazing ha. Could be cross-posting.
    Yep, that's my conclusion, that it's likely the same guy cross-posting.

Similar Threads

  1. Count number of digits in string using scanner
    By wendysbiggy in forum New To Java
    Replies: 35
    Last Post: 01-20-2010, 05:11 AM
  2. Digits of an integer.
    By Allgorythm in forum New To Java
    Replies: 8
    Last Post: 01-01-2010, 02:34 AM
  3. split() by digits
    By RobertF in forum New To Java
    Replies: 2
    Last Post: 03-12-2009, 02:16 AM
  4. Separating program logic and GUI
    By loopingman in forum AWT / Swing
    Replies: 0
    Last Post: 12-08-2008, 02:46 PM
  5. sum of digits depreciation
    By jleas in forum New To Java
    Replies: 13
    Last Post: 11-09-2008, 01:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •