Given an integer, write a function that returns the number of bits in the integer that are set.
Anonymous
int countSet(int x) { int count = 0; while(x) { if(x & 0x0001) count++; x = x >> 1; } return count; }
Check out your Company Bowl for anonymous work chats.