Contar Bits

Problem Link

Solution by SaoriKido100 pts

Code / Notes

#include <bits/stdc++.h>
using namespace std;

int main() {
     int N;
     cin >> N;
     int B=0;
     while (N > 0){
        B += N%2;
        N=N/2;
     }
     cout << B;
}

Last updated 1 month, 1 week ago


« Back to problem