Give a method to count the number of ones in a 32 bit number?
Answer Posted / ataraxic
int i = 0;
while (x) {
x &= x-1;
++i;
};
printf("number of ones is %d\n", i);
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Why is it important to memset a variable, immediately after allocating memory to it ?
how to execute a program using if else condition and the output should enter number and the number is odd only...
Can i use “int” data type to store the value 32768? Why?
What are compound statements?
What are static variables in c?
Write a program in "C" to calculate the root of a quadratic equation ax^2+bx+c=0, where the value of a,b & c are known.
Is the exit() function same as the return statement? Explain.
What is c method?
Why main is used in c?
What is difference between array and pointer in c?
about c language
What is .obj file in c?
how do you execute a c program in unix.
What is an identifier?
Q.1 write aprogram to stack using linklist o insert 40 items? Q.2 write a program to implement circular queue with help of linklist?