Asadullah Ansari

Build-Up Your Problem Solving Skill : Specially Using By C/C++/Data Structure Puzzles/New Technique Algorithm Design/ Understanding New Technology

write a program for bit count in a 32-bit integer number?

Posted by asadullahansari on August 21, 2008

Program should be efficient. Dont count every bit by loop…Cheers!!!!

One Response to “write a program for bit count in a 32-bit integer number?”


  1. int countBit(int intVal)
    {
    int nCount=0;
    for(nCount=0;intVal; ++nCount)
    intVal=intVal & (intVal-1)
    return count;
    }

    Give the other solution of it!!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

 
%d bloggers like this: