Valeo interview question

write an algorithm to count binary numbers in a byte.

Interview Answer

Anonymous

12 Dec 2015

int n=65045454; int count = 0; while (n > 0){ count ++; n = n & (n-1); } printf("%d\n",count);

3