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

write a program to find out number of on bits in a number?

Answer Posted / jaya j

unsigned int count1s(unsigned char x)
{
int p;
for(p=0;x!=0;x>>=1)
if(x&1)
p++;
return p;
}

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a program to print "hello world" without using a semicolon?

1059


How would you rename a function in C?

1038


Explain how can I make sure that my program is the only one accessing a file?

1219


What is identifiers in c with examples?

1176


When should a type cast not be used?

1060


How can you access memory located at a certain address?

1114


Tell us something about keyword 'auto'.

1072


What are structures and unions? State differencves between them.

1172


Create a simple code fragment that will swap the values of two variables num1 and num2.

1285


What are the rules for identifiers in c?

1064


Describe the order of precedence with regards to operators in C.

1047


write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?

2864


Is python a c language?

1002


Is there a way to switch on strings?

1083


How important is structure in life?

1082