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
what is bit rate & baud rate? plz give wave forms
write a program which the o/p should b in such a way that s triangle if I/p is 3,a Square/rectangle if I/P=4,a pentagon if I/P=5 and so on...forget about the I/P which is less than 3
What does struct node * mean?
What’s the special use of UNIONS?
program to find out date after adding 31 days to a date in the month of febraury also consider the leap year
Why is python slower than c?
Can you define which header file to include at compile time?
Explain what are reserved words?
What is use of pointer?
Apart from dennis ritchie who the other person who contributed in design of c language.
What is external variable in c?
What is typedef struct in c?
Explain a file operation in C with an example.
What are the 3 types of structures?
write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays