1//WAP to find setbits (total 1's in binary ex. n= 5 => 101 => 2 setbits
2int count{}, num{};
3 cin >> num;
4
5 while (num > 0) {
6 count = count + (num & 1); // num&1 => it gives either 0 or 1
7 num = num >> 1; // bitwise rightshift
8 }
9
10 cout << count; //count is our total setbits
11
12