Results 1 to 7 of 7

Thread: [Resolved] Splitting an Integer into parts?

Threaded View

  1. #1

    Thread Starter
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    Resolved [Resolved] Splitting an Integer into parts?

    Let's say I have an integer, greater than 10...can be anything valid for int (10, 100, 1000, etc).

    I need to split that number and get the last digit (0 in all the examples above)...so:

    Code:
    int x = 42;
    int y = 422;
    for x, I need to separate it into 4 and 2, and for y 42 and 2. I want to do this without casting to a string, if possible.

    What I have to do is right a program that does multiplication "by hand", so I need to take the last digit, and carry the rest over.

    Hope I explained it well enough to follow. Thanks in advance.
    Last edited by The Hobo; Oct 20th, 2004 at 02:43 PM.
    My evil laugh has a squeak in it.

    kristopherwilson.com

Posting Permissions

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



Click Here to Expand Forum to Full Width