Well the 'digit' depends on the number base, but I'm assuming you mean the decimal representation? In that case, you can extract the digit (D) by obtaining the modulo of the number (N) with 10. Run the even/odd test on D, increment the appropriate counters, and then divide N by 10 and repeat the process, until N is zero.