Dividing by 10 without remainder cuts off the rightmost digit. Try it yourself.
The operation %10 means dividing by 10 and keeping only the remainder. The remainder of division by 10 is always the rightmost digit in the number.
So you divide by 10 repeatedly until the rightmost digit is the one you want, then you do %10 to get that digit.
Latest Answers