Re: Getting the units of a number

From: Kevin Saff (google.com_at_kevin.saff.net)
Date: 10/23/03


Date: Thu, 23 Oct 2003 13:43:47 GMT


"Adrian Gibbons" <adriangibbons@yahoo.co.uk> wrote in message
news:34a2acd5.0310230429.742aed6b@posting.google.com...
> Hello,
>
> I need to get the units of a number.
>
> i.e. if I had 12345 then I would want '5'.
>
> I was looking at dividing the number by ten and using the modulus
> operator repeatedly until I had only the units, but wondered if there
> was an easier way?

You do know that any integer mod 10 is the units part (12345 % 10 == 5)
don't you? Or did you mean the number of digits in the integer?



Relevant Pages

  • question about montgomery reductions
    ... recall that the residue is ... the remainder when dividing by n? ... shiting one way and back the other, some digits will be zero'd out, ... the least k significant digits or by dividing or multiplying it by B ...
    (sci.crypt)
  • Re: Very OTP: Someething for you to try
    ... calculator when a pen and a bit of paper suffices? ... OK-- here's the math solution. ... Key in the first three digits of your phone number (NOT the area ... Before we do the last step of dividing by 2, ...
    (alt.support.arthritis)
  • Re: Very OTP: Someething for you to try
    ... remove the Gator cheer to email me ... OK-- here's the math solution. ... Key in the first three digits of your phone number (NOT the area ... Before we do the last step of dividing by 2, ...
    (alt.support.arthritis)
  • Re: Number of digits of float value
    ... > Is there a standard way of determining the number of digits ... > As is a loop dividing by 10. ... > a very basic/often needed function. ...
    (comp.lang.cpp)
  • Re: Very OTP: Someething for you to try
    ... OK-- here's the math solution. ... Key in the first three digits of your phone number (NOT the area ... Subtract 250 ... Before we do the last step of dividing by 2, ...
    (alt.support.arthritis)