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
What is meant by keywords in c?
What is this pointer in c plus plus?
Explain what are compound statements?
Is flag a keyword in c?
What is anagram in c?
What should malloc(0) do?
write a program to copy the string using switch case?
What are the storage classes in C?
Describe static function with its usage?
What is the correct code to have following output in c using nested for loop?
What is string function c?
Is c is a middle level language?
What is the purpose of main( ) in c language?
Is c compiled or interpreted?
How to write c functions that modify head pointer of a linked list?