separating integer in different values

i'm trying to connect my arduino to 3 7-segment displays using a max7221 and the ledcontrol library, but now i've ran into a problem.

i want to display an value that comes from the A/D converter ( a number from 0 to 1023) the value isn't going to go any higher than 999.

with ledcontrol you can only send a number from 0 to 9 to a display, so i need to "separate" numbers in individual numbers to send them to each corresponding display. analogRead gives me the number 587 , this has to be separated into the numbers 5 , 8 and 7.

how can i do this?


unsigned Value;
byte FirstDigit;
byte SecondDigit;
byte ThirdDigit;

/* Value contains the value read from analogRead */
/* FirstDigit is the right-most digit from Value */

FirstDigit = Value % 10;
Value = Value / 10;
SecondDigit = Value % 10;
Value = Value / 10;
ThirdDigit = Value /*% 10*/;