From: Sebastian Hungerecker Date: 2007-02-18T16:50:07+09:00 Subject: Re: modulus/division.. Derek Teixeira wrote: > okay, cool. i found the answer to the question on a forum online ... > m_mod = input%1000 Puts the remainder of division by 1000 (i.e. the three last digits of the number) in m_mod. > d_mod = input%500 Remainder of division by 500 (i.e. the three last digits or if that number would be higher than 500, the three last digits minus 500) > c_mod = input%100 2 last digits. > l_mod = input%50 2 last digits minus 50 if necessary. > x_mod = input%10 Last digit. > v_mod = input%5 Last digit minus 5 if necessary. > m_div = input/1000 Divides the number by 1000, cutting of everything after the point (because this is integer division). So basically this returns everything but the three last digits. > d_div = m_mod/500 This is one if the third to last digit (i.e. the one who specifies the hundreds) is 5 or higher and zero otherwise. > c_div = d_mod/100 The third to last digit minus 5 if it's 5 or higher. > l_div = c_mod/50 > x_div = l_mod/10 > v_div = x_mod/5 > i_div = v_mod/1 The same thing for the second to last and last digit accordingly. > do you think you explain to me why the % and / works here? I hope this is what I just did and you understand it now. HTH, Sebastian Hungerecker -- Ist so, weil ist so Bleibt so, weil war so