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...

how do u find out the number of 1's in the binary
representation of a decimal number without converting it
into binary(i mean without dividing by 2 and finding out
the remainder)? three lines of c code s there it
seems...can anyone help

Answer Posted / barun

int x =0x1;
static count;
while(no ! =0)
{
if((no >>1 & x) ==1)
count+=1;
}
printf("%d",count);

Is This Answer Correct ?    7 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

write a program to display all prime numbers

1977


What is an operator?

1081


What is sorting in c plus plus?

982


Can variables be declared anywhere in c?

1095


what are the facialities provided by you after the selection of the student.

2266


List a few unconditional control statement in c.

991


What's the right way to use errno?

1149


Is there a built-in function in C that can be used for sorting data?

1272


What’s a signal? Explain what do I use signals for?

1116


For what purpose null pointer used?

1086


What is a structure in c language. how to initialise a structure in c?

1067


What is putchar() function?

1170


What is else if ladder?

1027


Explain what is meant by high-order and low-order bytes?

1053


Why c is called procedure oriented language?

1060