in Programming in C retagged by
712 views
0 votes
0 votes
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++;
		}
	}
}
  1. The value of count variable after execution of the above code?
  2. The value of count variable when $n = m$ ?

[EDITED] 

in Programming in C retagged by
by
712 views

1 Answer

3 votes
3 votes

hope it helps.......

4 Comments

@akash.dinkar12  : sorry: I am changing $m$ with $k$ inside the code.

1
1

ur previous code                                                current code

Output should remain same, how can replacement affect the output by only changing the name of variable....

0
0
I did not mean that: I changed $m$ because I also mentioned $n = m$ statement:: not to confuse , I changed $m$ with $k$ inside the code.
0
0

Related questions