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

How many levels of pointers can you have?

695


how to introdu5ce my self in serco

1521


When should the volatile modifier be used?

677


which of the following shows the correct hierarchy of arithmetic operations in C a) (), **, * or/,+ or - b) (),**,*,/,+,- c) (),**,/,*,+,- d) (),/ or *,- or +

1176


What language is c written?

572






Hai what is the different types of versions and their differences

1484


Describe the difference between = and == symbols in c programming?

771


What is a lookup table in c?

622


Why header files are used?

640


In C language, a variable name cannot contain?

737


Explain what are global variables and explain how do you declare them?

635


How would you obtain the current time and difference between two times?

720


which type of aspect you want from the student.

1697


When should a type cast be used?

573


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

1115