count = 0
循环
将原数和(7)相与
右移(3)
判断结果:
0:count +=0;
1,2,4:count +=1;
3,5,6:count += 2;
7:count +=3;
输出count
求十进制数对应的二进制数中1的个数
最新推荐文章于 2022-09-08 21:32:35 发布
count = 0
循环
将原数和(7)相与
右移(3)
判断结果:
0:count +=0;
1,2,4:count +=1;
3,5,6:count += 2;
7:count +=3;
输出count