In C language, how many bits are different in the binary expressions of two int (32-bit) integers m and n?
Method 1: # include <stdio. h> int bit_dif (int a, int B) {int I = 0; int ret = 0; int num = 0; ret = a ^ B; for (I = 0; I <32; I ++) {if (ret & 1 = 1) {num ++;} ret = ret> 1;} return num;} int main () {int count = 0; int num1 = 0; int num2 = 0; printf ("enter two numbers, separated by spaces \ n "); scanf ("% d", & num1, & num2); count = bit_dif (num1, num2); printf ("% d \ n", count ); return 0;} Method 2: (optimized) # include <stdio. h> int bit_dif (int a, int B) {int I = 0; int ret = 0; int num = 0; ret = a ^ B; while (ret) {num ++; ret = ret & (ret-1);} return num;} int main () {int count = 0; int num1 = 0; int num2 = 0; printf ("enter two numbers, separated by spaces \ n"); scanf ("% d", & num1, & num2); count = bit_dif (num1, num2); printf ("% d \ n", count); return 0 ;}