c语言
求int型正整数在内存中存储时1的个数
http://www.nowcoder.com/questionTerminal/440f16e490a0404786865e99c6ad91c9
#include<stdio.h> int main() { int iNumber; while (scanf("%d", &iNumber) != EOF){ int iCount = 0; int i = 0x1; do { if(iNumber & i) { iCount++; } } while((iNumber = iNumber >> 1 )!= 0); printf("%d\n", iCount); } return 0; }