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 || operator and how does it function in a program?
What is data structure in c programming?
What is bubble sort technique in c?
Hai,I have done with my bachelor of commerce and planing to ms,please suggest me how to convince vo for shifting from commerce to computers. Visa on 8 DEC 2014 Npu university
What does the error 'Null Pointer Assignment' mean and what causes this error?
Describe the steps to insert data into a singly linked list.
Is there a way to compare two structure variables?
What is the difference between text and binary i/o?
Where define directive used?
Can we increase size of array in c?
What is #include conio h?
What are the data types present in c?
Why is c called "mother" language?
In C programming, how do you insert quote characters (‘ and “) into the output screen?
What is the difference between null pointer and wild pointer?