Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Give a method to count the number of ones in a 32 bit number?

Answer Posted / ataraxic

int i = 0;

while (x) {
x &= x-1;
++i;
};

printf("number of ones is %d\n", i);

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Where register variables are stored in c?

967


What is double pointer?

1000


How do you determine whether to use a stream function or a low-level function?

1124


What is the correct code to have following output in c using nested for loop?

1082


The statement, int(*x[]) () what does in indicate?

1149


Describe how arrays can be passed to a user defined function

1295


Why can’t we compare structures?

1275


Who invented bcpl language?

1195


What is function prototype in c language?

1031


What are type modifiers in c?

1052


How pointer is different from array?

1076


write a program to generate address labels using structures?

4573


What is void main () in c?

1212


What functions are in conio h?

1190


What are types of preprocessor in c?

1073