Saturday, 15 June 2013

c# - Converting an integer to an array of digits -



c# - Converting an integer to an array of digits -

this question has reply here:

is there easy way turn int array of ints of each digit? 7 answers

i want know if there way in c# convert integer array of digits can perform (mathematical) operations on each digit alone.

example: need user input integer i.e 123, 456 programme creates 2 arrays of 3 elements {1,2,3}, {4,5,6}.

off top of head:

int = 123; var digits = i.tostring().select(t=>int.parse(t.tostring())).toarray();

c#

No comments:

Post a Comment