#include<iostream>
using namespace std;
int main()
{
int n;
while (cin >> n)
{
int count = 0;
while (n)
{
if ((n & 1) == 1)
{
count++;
}
n >>= 1;
}
cout << count << endl;
}
system("pause");
return 0;
}
查找输入整数二进制中1的个数
猜你喜欢
转载自blog.csdn.net/weixin_44781382/article/details/105282590
今日推荐
周排行