Getting digits from
integers.
n
Using the
%
and
/
operator, we can
extract each digit.
n
Suppose a combination 123.
n
123 % 10
-> 3
n
123 / 10 -> 12
n
12 % 10 -> 2
n
12 / 10 -> 1
n
% 10
gets the last digit and
/ 10
get the remaining digits.