Sample Source Code for programming problems
Java, c, C++, win32, .net, C#, ASP, VB, ADO, and many more
Monday, July 28, 2008
C Source code for counting 1's in a number.
int bitcount (unsigned int n)
{
int count=0;
int counter =0;
while (n)
{
count += n & 0x1u ;
n >>= 1 ;
counter++;
}
return count ;
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
Your Title
No comments:
Post a Comment