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
How can I implement sets or arrays of bits?
What will be the outcome of the following conditional statement if the value of variable s is 10?
Write a program to input the price of 1 burger and the number of burgers eaten by a group of friends .print the total amount to be paid by the group?
Is stack a keyword in c?
How to draw the flowchart for structure programs?
What is the argument of a function in c?
What is a built-in function in C?
What is the newline escape sequence?
in case any function return float value we must declare a) the function must be declared as 'float' in main() as well b) the function automatically returned float values c) function before declared 'float' keyword d) all the above
Is c programming hard?
Write a function expand(s1,s2) that expands shorthand notations like a-z in the string s1 into the equivalent complete list abc...xyz in s2 . Allow for letters of either case and digits, and be prepared to handle cases like a-b-c and a-z0-9 and -a-z. z-a:zyx......ba -1-6-:-123456- 1-9-1:123456789987654321 a-R-L:a-R...L a-b-c:abbc
what is reason of your company position's in india no. 1.
Which is better between malloc and calloc?
how could explain about job profile
Explain about block scope in c?