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 / ravi saini
unsigned int count=0,no;
/*
Enter no Here................
*/
while(no ! =0)
{
if((no & 0x01) ==1)
count++;
no=no >>1
}
printf("%d",count);
Is This Answer Correct ? | 9 Yes | 3 No |
Post New Answer View All Answers
Explain how can I open a file so that other programs can update it at the same time?
How can I write a function analogous to scanf?
Is c call by value?
Explain what is #line used for?
How to write a code for reverse of string without using string functions?
How do c compilers work?
What does the error message "DGROUP exceeds 64K" mean?
What does the && operator do in a program code?
What is meant by type casting?
What is spaghetti programming?
How do you define CONSTANT in C?
Do character constants represent numerical values?
What is array of structure in c?
Why is it usually a bad idea to use gets()? Suggest a workaround.
What is adt in c programming?