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

Why do we use static in c?

1140


find the sum of two matrices and WAP for it.

1146


Is c is a high level language?

1197


Who developed c language?

1102


Is null valid for pointers to functions?

1183


What is the difference between void main and main in c?

1159


What is #line in c?

1020


c program to compute AREA under integral

2414


What are the Advantages of using macro

1177


How do you construct an increment statement or decrement statement in C?

1241


What’s the special use of UNIONS?

1152


Why is c platform dependent?

1098


What is the difference between text files and binary files?

1354


Explain #pragma statements.

1058


What is const keyword in c?

1167