您的位置:首页 > 其它

两个整数m和n表达式中,有几个二进制位不同

2018-03-29 16:36 197 查看
#include<stdio.h>
#include<stdlib.h>
int main()
{
int m,n;
int count=0;
int tmp=0;
printf("请输入两个任意整数:\n");
scanf("%d %d",&m,&n);
tmp=n^m;
while(tmp)
{
count++;
tmp=tmp&(tmp-1);
}
printf("count=%d\n",count);
system("pause");
return 0;


运行结果

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐