Update appNew update is available. Click here to update.
About
As a software engineer at Futurionic, I craft robust and innovative web applications that bring ideas to life. I utilize a diverse tech stack that includes C++, C, Redux.js, and other front-end and ba...
J. D. College of Engineering And Management,Nagpur 2026
My Stats
EXP gained
yellow-spark
4515
Level
5 (Champion)
Community stats
Discussions
0
Upvotes
0
Know more
179
Total problems solved
173
Easy
6
Moderate
0
Hard
0
Ninja
Dec Dec Jan Jan Feb Feb Mar Mar Apr Apr May May Jun Jun Jul Jul Aug Aug Sep Sep Oct Oct Nov Nov

Current streak:

0 days

Longest streak:

7 days

Less

More

Achievements
1
Samurai
Guided path
Basics of C++
Discussions
Easy C++ solution and 83% faster
Interview problems

#include <bits/stdc++.h>

#include <iostream>

using namespace std;

 

int countBits(int n) {

int setBit = 0;

while (n != 0) {

if (n & 1) {

setBit++;

}

n >>= 1;

}

return setBit;

}

 

int main() {

int n;

cin >> n;

cout << countBits(n);

return 0;

}

profile
md_readul_islam
Published On 11-Sep-2023
178 views
0 replies
0 upvotes