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
develop algorithms to add polynomials (i) in one variable
Is fortran faster than c?
What are pointers? What are different types of pointers?
Mention four important string handling functions in c languages .
What is volatile keyword in c?
How can I call a function with an argument list built up at run time?
What are the types of pointers?
Without Computer networks, Computers will be half the use. Comment.
Why c is known as a mother language?
What is the usage of the pointer in c?
Explain how can I convert a string to a number?
What are different types of operators?
Explain function?
What is && in c programming?
Why void main is used in c?