求两个数的二进制位的不同位数
#include<stdio.h>
int main ()
{
int a = 0;
int b = 0;
int m = 0;
int i = 0;
int count = 0;
scanf_s("%d%d",&a,&b);
m=a^b;
for(i=31;i>=0;i--)
{
if(((m>>i)&1)==1)
{
count++;
}
}
printf("count=%d",count);
return 0;
}
int main ()
{
int a = 0;
int b = 0;
int m = 0;
int i = 0;
int count = 0;
scanf_s("%d%d",&a,&b);
m=a^b;
for(i=31;i>=0;i--)
{
if(((m>>i)&1)==1)
{
count++;
}
}
printf("count=%d",count);
return 0;
}