#include<stdio.h>
#include<windows.h>
int countBits(int x)
{
int c = 0;
while (x)
{
x &= (x - 1);
c++;
}
return c;
}
int main()
{
int ret = countBits(1999 ^ 2999);
printf("%d\n", ret);
system("pause");
return 0;
}
#include<stdio.h>
#include<windows.h>
int countBits(int x)
{
int c = 0;
while (x)
{
x &= (x - 1);
c++;
}
return c;
}
int main()
{
int ret = countBits(1999 ^ 2999);
printf("%d\n", ret);
system("pause");
return 0;
}