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
What is size of union in c?
Explain bit masking in c?
a formula,a series of steps,or well defined set of rules for solving a problem a) algorithem b) program c) erdiagram d) compiler
What is queue in c?
What is a file descriptor in c?
my project name is adulteration of chille powder.how can i explain it to the hr when he asks me about the project?
please explain every phase in the "SDLC" in the dotnet.
What is a 'null pointer assignment' error? Explain what are bus errors, memory faults, and core dumps?
Why n++ execute faster than n+1 ?
Apart from dennis ritchie who the other person who contributed in design of c language.
Without Computer networks, Computers will be half the use. Comment.
2) Write a program that will help Air Traffic Control for an airport to view the sequence of flights ready for take-off. The airport can accommodate 10 flights waiting for take-off at any point in time. Each flight has a unique 3 digit numeric identifier. Each time a flight takes-off, Air Traffic Control adds a flight to the waitlist. Each time a flight is added to the waitlist, the list of flights waiting to take-off must be displayed. When a flight is cleared for take-off, Air Traffic Control removes the flight from the waitlist. Each time a flight takes-off, the list of flights waiting to take-off must be displayed. Sequence of take-off is the sequence of addition to the waitlist
What is function in c with example?
Write a program on swapping (100, 50)
Define macros.