Look at using the % and the / operators.
% will extract the right most digit
/ will shift the digits to the right