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
2010-10-23 13:42:40
thank you... :) i m really new in this programming language
marco
2010-10-23 13:46:16
@ifan: If the answer solved your problem, please consider clicking the check mark next to the answer, to mark it as correct.
sepp2k
2010-10-23 13:57:54
how can i reverse the list ?
marco
2010-10-23 14:05:06
@ifan: By removing the call to the `reverse` function.
sepp2k
2010-10-23 14:07:20
digs 0 = []digs x = digs (x `div` 10) ++ [x `mod` 10]i take this one as a answer
marco
2010-10-23 14:12:37
i have done it thank you
marco
2010-10-23 14:17:27
+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
2010-10-23 13:45:45