write a program to find out number of on bits in a number?
Answer Posted / minisha
int count(unsigned int n)
{
int c=0;
while(n)
{
n=n&(n-1);
c++
}
return c;
}
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the purpose of main() function?
Explain what is the most efficient way to store flag values?
What is a constant?
What are the usage of pointer in c?
What are multibyte characters?
typedef enum { html, java, javascript, perl, cgi } lang;The above statement defines a : a) Union b) User defined type c) Enumerated variable d) none
Explain logical errors? Compare with syntax errors.
Explain the difference between null pointer and void pointer.
What is %s and %d in c?
How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same
What is the difference between procedural and functional programming?
What is structure in c language?
What is the difference between formatted&unformatted i/o functions?
What is non linear data structure in c?
Describe dynamic data structure in c programming language?