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 / ravi saini

unsigned int count=0,no;
/*
Enter no Here................
*/
while(no ! =0)
{
if((no & 0x01) ==1)
count++;
no=no >>1
}
printf("%d",count);

Is This Answer Correct ?    9 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

develop algorithms to add polynomials (i) in one variable

2148


Is fortran faster than c?

1031


What are pointers? What are different types of pointers?

1119


Mention four important string handling functions in c languages .

1079


What is volatile keyword in c?

1025


How can I call a function with an argument list built up at run time?

1225


What are the types of pointers?

1093


Without Computer networks, Computers will be half the use. Comment.

2288


Why c is known as a mother language?

1075


What is the usage of the pointer in c?

1095


Explain how can I convert a string to a number?

1076


What are different types of operators?

1025


Explain function?

1076


What is && in c programming?

1157


Why void main is used in c?

1042