#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
int m = 0;
int n = 0;
int tmp = 0;
int count = 0;
printf("输入两个整数\n");
scanf("%d%d",&m,&n);
tmp = m^n;
while (tmp > 0)
{
if (tmp % 2 == 1)
count++;
tmp = tmp / 2;
}
printf("%d\n", count);
system("pause");
return 0;
}
两个int(32位)整数m和n的二进制表达中,有多少个位(bit)不同
最新推荐文章于 2020-07-26 21:28:35 发布