Welcome~~~


Another blog:
http://fun-st.blogspot.com/

It is easier to write an incorrect program than understand a correct one.

Wednesday, February 9, 2011

# Given a integer, count how many 1s in the binary format of that interger

int countBits(int i)
{
   int count = 0;
   while (i>0)
{
   count += (i & 0x01);
   i>>1;
}
return count;
}


♥ ¸¸.•*¨*•♫♪♪♫•*¨*•.¸¸♥

No comments:

Post a Comment