how to retrieve some value from a value?

If you have a 3 digit value, like 123, you can get the hundredths, tenths and ones values easily enough.

int val = 123;

int ones = val % 100; // ones = 3
int rest = val/10; // rest = 12
int tens = rest % 10; tens = 2
int huns = rest / 10; huns = 1

Some adjustments need to be made if the value is a 4 digit or 5 digit value, obviously.