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

What are the two types of functions in c?

954


When would you use a pointer to a function?

1000


Do you know the use of 'auto' keyword?

1138


how many types of operators are include in c language a) 4 b) 6 c) 8 d) 12

1031


What is the difference between array and linked list in c?

1095


What is the difference between mpi and openmp?

1228


If a five digit number is input through the keyboard, write a program to print a new number by adding one to each of its digits.For example if the number that is input is 12391 then the output should be displayed as 23402

3856


What is pass by reference in functions?

787


Explain the difference between structs and unions in c?

969


what do the 'c' and 'v' in argc and argv stand for?

1121


Difference between MAC vs. IP Addressing

1104


which of the following is not a character constant a) 'thank you' b) 'enter values of p, n ,r' c) '23.56E-o3' d) all of the above

2015


What is c language & why it is used?

1047


Can you please explain the difference between exit() and _exit() function?

996


What is the purpose of clrscr () printf () and getch ()?

1033