tags:

views:

104

answers:

2

how can i do this integer value is converted to integerlist with three pairs from the and of the integer input : 24889375 output : [375,889,24]

+3  A: 

The same way you do it with one digit, except that you divide and mod by 1000 instead of 10.

sepp2k
thank you... :) i m really new in this programming language
marco
@ifan: If the answer solved your problem, please consider clicking the check mark next to the answer, to mark it as correct.
sepp2k
how can i reverse the list ?
marco
@ifan: By removing the call to the `reverse` function.
sepp2k
digs 0 = []digs x = digs (x `div` 10) ++ [x `mod` 10]i take this one as a answer
marco
i have done it thank you
marco
+2  A: 

You don't list the language, so this will be pseudo code. Use the mod operator (% in The following)

First number = X % 1000; Second Number = (X/1000)%1000; Third Number = (X/1000000)%1000;

Note that these operations are all integer operations. The above only works if the / divide operator is an integer divide. If not, truncate it before calculating the modulo.

winwaed
The language (Haskell) is in the tags.
sepp2k
Sorry still a newbie here and missed that. I'm not a Haskell guy, so my answer might not be applicable. Can delete if deemed not relevant...
winwaed