N = 5732 (in example)

while ( N > 0 )
{
     push( N % 10 );
     N = N / 10;
}

This will give you digits in reverse order. Read it in reverse order or store it in stack.

~Vishal

On 9/17/06, Bullislander05 <[EMAIL PROTECTED]> wrote:

Hello,

I'm fairly new to these parts and I come to ask a question.

If anyone here has some experience in programming in Java, I would be
enlightened to find out if there is any way to extract each digit from
an integer.

Say there was an integer with a value of 5732, how should I proceed to
extract the 5, 7, 3, and 2 from said integer and transfer those values
into an integer array?

If anybody could help me out A.S.A.P I would be very grateful.

Thank you,
Bullislander05






--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to