#include<stdio.h>
int count_num(unsigned int num)
{
int count = 0;
while (num)
{
if (num % 2 == 1)
{
count++;
}
num =num / 2;
}
return count;
}
int main()
{
int num;
scanf_s("%d",&num);
int count = count_num(num);
printf("%d", count);
return 0;
}
求整数补码有多少个1
最新推荐文章于 2024-03-24 14:56:40 发布