C programming
#include <stdio.h> int foo(unsigned word) { int n = 0; int num_set_bits[16] = {0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4}; while( word > 0 ) { n += num_set_bits[ word & 0xF ]; word >>= 4; } return n; } int main() { printf("%d\n",foo(0xABC)); return 0; } Output of the above program ?
#include <stdio.h int foo(unsigned word) { int n = 0; int num_set_bits[16] = {0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4}; while( word 0 ) { n += num_set_bits[ word & 0xF ]; word >...