write a program to find out number of on bits in a number?
Answer Posted / jaya j
unsigned int count1s(unsigned char x)
{
int p;
for(p=0;x!=0;x>>=1)
if(x&1)
p++;
return p;
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What are the different types of constants?
Is it fine to write void main () or main () in c?
What are the restrictions of a modulus operator?
Explain data types & how many data types supported by c?
Given a valid 24 hour format time find the combination of the value and write a program ,do not hard the value and if any other inputs provided should work with the logic implemented Input: 11:30 Output: 13:10 Input: 18:25 Output: 21:58
What are reserved words?
Are local variables initialized to zero by default in c?
Which is better oop or procedural?
Explain what are preprocessor directives?
Why do we use pointer to pointer in c?
How can I run c program?
Explain spaghetti programming?
Explain what is wrong with this program statement?
What does s c mean in text?
Why c is a procedural language?