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. :)

Recommended Answers

All 4 Replies

Hello,

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.