#include <iostream>
using namespace std;
//count no of ones in binary representation
int count1(int n)
{
int c=0;
while(n)
{
n=n&(n-1);
cout<<n;
c++;
}
return c;
}
int main(){
cout<<count1(6);
return 0;
}
No comments:
Post a Comment