write a program to find out number of on bits in a number?

Answer Posted / anilkumar

int n ; \\any number
for(count=0;n&=(n-1); count++);
printf("%d", count);

Is This Answer Correct ?    11 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

design and implement a data structure and performs the following operation with the help of file (included 1000 student marks in 5 sub. and %also) 1.how many students are fail in all 5 subjects (if >35) 2. delete all student data those are fail in all 5 subjects. 3. update the grace marks (5 no. if exam paper is 100 marks) 4. arrange the student data in ascending order basis of marks. 5.insert double of deleted students with marks in the list.

1497


What is the size of structure in c?

702


Explain what are binary trees?

613


What is define c?

574


What is the difference between constant pointer and constant variable?

748






What are bitwise shift operators in c programming?

646


Without Computer networks, Computers will be half the use. Comment.

1877


What is const volatile variable in c?

577


Differentiate between functions getch() and getche().

622


Why do we use int main instead of void main in c?

621


process by which one bit patten in to another by bit wise operation is? (a) masking, (b) pruning, (c) biting, (d) chopping,

1892


What are the advantage of c language?

553


Differentiate abs() function from fabs() function.

596


What are the types of unary operators?

662


what is bit rate & baud rate? plz give wave forms

1519