Answers for "count bits c++"

C++
0

count bits c++

//Method 1
   int count = 0;
   while (n)
   {
        count++;
        n >>= 1;
    }
//Method 2
	int count = (int)log2(number)+1;
Posted by: Guest on May-10-2021

Browse Popular Code Answers by Language