Basically what my program does.
It has one main.
It has one function.

The function is:

int humhum (unsigned long x, unsigned long y)
unsigned long res;
        printf("Enter an integer for x:");
	scanf( "%ul", &x);
	printf("\nEnter an integer for y:");
	scanf("%ul", &y);
	res = x ^ y;


Now res will use exclusive ^OR to compare two numbers in binary mode. But what do i do here to use res and and count how many 0s does res have?

I also need to call this function in the main, and then state that this many zeroes are in res.

Thank you for your help. :)

9 Years
Discussion Span
Last Post by WaltP


It doesn't help. What i want to do is convert res into binary and find how many zeros it has.. and then print it in the main.. saying it has X amount of zeros.


No wonder those links don't help. They have nothing to do with the problem.

First off, res is already binary. If you know the shift operator (<<), that makes it easy to count the 0's. Look it up and see what you come up with.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.