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 local static variables?
Explain what are header files and explain what are its uses in c programming?
i want to switch my career from quailty assurance engineering to development kindly guide me from which programming language its better for me to start plz refer some courses or certifications too i have an experience of 1.5 yrs in QA field.Kindly guide me
Can math operations be performed on a void pointer?
a value that does not change during program execution a) variabe b) argument c) parameter d) none
What is pass by reference in functions?
What is New modifiers?
What is %d called in c?
What are 'near' and 'far' pointers?
If i have an array 0 to 99 i.e,(Size 100) I place the values 1 to 100 randomly like a[0]=29,a[1]=56 upto array[99].. the values are only between 1 to 100. getting the array values by using scanf.. If i entered one wrong element value line a[56]=108. how can i find it.. and also how to find the missing value in 1 to 100.. and i want to replace the missing values.. any one of them know please post your answer..
Do you know pointer in c?
What is the best way to comment out a section of code that contains comments?
How can a number be converted to a string?
What is the difference between the local variable and global variable in c?
Is there a built-in function in C that can be used for sorting data?