how do u find out the number of 1's in the binary
representation of a decimal number without converting it
into binary(i mean without dividing by 2 and finding out
the remainder)? three lines of c code s there it
seems...can anyone help
Answer Posted / barun
int x =0x1;
static count;
while(no ! =0)
{
if((no >>1 & x) ==1)
count+=1;
}
printf("%d",count);
| Is This Answer Correct ? | 7 Yes | 2 No |
Post New Answer View All Answers
What is data structure in c and its types?
Linked lists -- can you tell me how to check whether a linked list is circular?
The number of bytes of storage occupied by short, int and long are a) 2, 2 and 4 b) 2, 4 and 4 c) 4, 4 and 4 d) none
What is a structural principle?
What is default value of global variable in c?
What is wrong in this statement? scanf(ā%dā,whatnumber);
How do you convert strings to numbers in C?
what do you mean by enumeration constant?
What is union and structure?
process by which one bit patten in to another by bit wise operation is? (a) masking, (b) pruning, (c) biting, (d) chopping,
Write a program to reverse a linked list in c.
What are the different categories of functions in c?
Why is c called "mother" language?
What is union in c?
What are the advantages of using linked list for tree construction?