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

What is meant by keywords in c?

1068


What is this pointer in c plus plus?

1086


Explain what are compound statements?

1061


Is flag a keyword in c?

1153


What is anagram in c?

913


What should malloc(0) do?

1119


write a program to copy the string using switch case?

2897


What are the storage classes in C?

1159


Describe static function with its usage?

1208


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

1080


What is string function c?

1022


Is c is a middle level language?

1063


What is the purpose of main( ) in c language?

1135


Is c compiled or interpreted?

1192


How to write c functions that modify head pointer of a linked list?

984