diff --git "a/Brian_Kernighan\342\200\231s_Algorithm.cpp" "b/Brian_Kernighan\342\200\231s_Algorithm.cpp" new file mode 100644 index 0000000..82d2950 --- /dev/null +++ "b/Brian_Kernighan\342\200\231s_Algorithm.cpp" @@ -0,0 +1,15 @@ +#include +using namespace std; +int main() +{ + int n; + cin>>n; + int count = 0; // initializing count to 0 + while(n) // run a loop till n is not equal to zero + { + n = n&(n-1); + count++; + } + cout<