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
write a program to display all prime numbers
What is an operator?
What is sorting in c plus plus?
Can variables be declared anywhere in c?
what are the facialities provided by you after the selection of the student.
List a few unconditional control statement in c.
What's the right way to use errno?
Is there a built-in function in C that can be used for sorting data?
What’s a signal? Explain what do I use signals for?
For what purpose null pointer used?
What is a structure in c language. how to initialise a structure in c?
What is putchar() function?
What is else if ladder?
Explain what is meant by high-order and low-order bytes?
Why c is called procedure oriented language?