#include <stdio.h>
#include <windows.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)不同?
最新推荐文章于 2019-10-17 22:42:58 发布