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 is bit rate & baud rate? plz give wave forms

1914


write a program which the o/p should b in such a way that s triangle if I/p is 3,a Square/rectangle if I/P=4,a pentagon if I/P=5 and so on...forget about the I/P which is less than 3

2030


What does struct node * mean?

965


What’s the special use of UNIONS?

1106


program to find out date after adding 31 days to a date in the month of febraury also consider the leap year

3019


Why is python slower than c?

1023


Can you define which header file to include at compile time?

982


Explain what are reserved words?

1041


What is use of pointer?

1011


Apart from dennis ritchie who the other person who contributed in design of c language.

1321


What is external variable in c?

1010


What is typedef struct in c?

1000


Explain a file operation in C with an example.

1054


What are the 3 types of structures?

980


write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays

2186