예제 #1
0
int main(void)
{
	int ret;
	int i,sum=0;

	printf("demo count bit 1 \n");

   // ret = count_bit_1(0x64);

    for(i = 1; i <= 100; i++)
	{
      ret = count_bit_1(i);
	  sum += ret;
	}

	//result = 3(0x64 = 0110 0100)
	printf("100 has %d bit 1\n",sum);
	}
예제 #2
0
int main(void)
{
	printf("%d has <%d> \'1\'\n", N, count_bit_1(N));

	return 0;
}