online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <iostream> using namespace std; int countSetBits(int n) { int res = 0; if (n == 1){ return 1; } else { while (n > 0) { n = (n & (n - 1)); res++; } return res; } } int main() { int t; while (t--) { int a, b, setBits = 0; cin >> a >> b; for (int i = a; i <= b; i++) { setBits += countSetBits(i); } cout << setBits; } cout << endl; return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue