int main() { int n = 3,i,count=0; for(i=0;i<1<<n;i++) { int p = i; while(p) { int k = p & -p; p = p - k; count++; } } }
[EDITED]
hope it helps.......
@akash.dinkar12 : sorry: I am changing $m$ with $k$ inside the code.
ur previous code current code
Output should remain same, how can replacement affect the output by only changing the name of variable....
64.3k questions
77.9k answers
244k comments
80.0k users