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
in ‘C’ language for Matrix Multiplication fails” Introspect the causes for its failure and write down the possible reasons for its failure.
Where are c variables stored in memory?
What is the difference between memcpy and memmove?
What is equivalent to ++i+++j?
Explain what are global variables and explain how do you declare them?
Explain how can type-insensitive macros be created?
a=10;b= 5;c=3;d=3; if(a printf(%d %d %d %d a,b,c,d) else printf("%d %d %d %d a,b,c,d);
Explain the red-black trees?
Should a function contain a return statement if it does not return a value?
What is structure in c definition?
Can we access the array using a pointer in c language?
What are nested functions in c?
Explain what’s a signal? Explain what do I use signals for?
Can we declare variable anywhere in c?
I was asked to write a program in c which when executed displays how many no.of clients are connected to the server.