#include <stdio.h> #include <stdlib.h> int main() { int i = 0; int x = 1999; int y = 2299; int count = 0; for (i = 0; i < 32; i++) { if ((x % 2) ^ (y % 2) == 1) { count++; } x /= 2; y /= 2; } printf("%d\n", count); system("pause"); return 0; }
【C语言】【笔试题】两个int(32位)整数m和n的二进制表达中,有多少个位(bit)不同
原创安下 ©著作权
文章标签 C语言 两个int(32位)整数m和n的二进制表 有多少个位(bit)不同 文章分类 C/C++ 后端开发
-
如何实现:两个int(32位)整数m和n的二进制表达中,有多少个位(bit)不同?
两个int(32位)整数 m和 n的二进制表达中,有多少个
#include 运算符 #define -
求出两个int(32位)整数m和n的二进制表达中,有多少bit位不同
编程实现两个int(32位)整数m和n的二进制表达中,有多少bit位不同
1.编程实现 两个int(32位)整数m 有多少bit位不同 -
c语言:输入两个整数m和n,计算需要改变m的二进制表示中的多少位才能得到n
c语言:输入两个整数m和n,计算需要改变m的二进制表示中的多少位才能得到n
c语言 剑指offer 输入两个整数 -
求整数 在二进制表示中有多少个1的方法
一共有三种方法实现,具体看下面第一种第二种
#include ios 测试程序