include<stdio.h>
include<stdlib.h>
int main()
{
int n = 0;
int m = 0;
int i = 0;
int count = 0;
scanf("%d %d", &n, &m);
for (i = 0; i < 32; i++)
{
if (((m >> i) & 1) != ((n>>i)&1))
{
count++;
}
}
printf("count = %d", count);
system("pause");
return 0;
}
比较两个二进制数字的不同数字
最新推荐文章于 2023-07-05 15:18:34 发布