pseudocode to split number value to array of numbers
num_to_arr(num):
   length_of_arr = log(num)+1 //log(num) base 10
   arr[length_of_arr]
   digit = 0

   while num &gt; 0:
      digit = num % 10
      arr[length_of_arr - 1] = digit
      length_of_arr = length_of_arr - 1
      num = num / 10

return arr


This should do the job.