Given a binary number, how do we get the last decimal digit?

1.7k Views Asked by At

Given a binary representation of 25 i.e 11001, if I am interested only in the last decimal digit, how do I get it?

1

There are 1 best solutions below

2
On BEST ANSWER

From right to left, the binary place values (mod 10) are $1, 2, 4, 8, 6, 2, 4, 8, 6, \dots$. You can add the reduced (mod 10) place values with $1$s in them, and then mod your answer by ten.

In your example, $11001$, you would add $8 + 6 + 0 + 0 + 1=15\equiv 5 \pmod{10}$.