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 to asadullahansari Cancel reply