• retagged by
1,479 views
0 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] 

1 Answer

3 3 votes

hope it helps.......

Position:
Show:

Related questions

0 0 votes
2 answers 2 answers
1.5k
1.5k views
go_editor asked Mar 26, 2020
1,527 views
Suppose $x$ and $y$ are two Integer Variables having values $0\text{x5AB6}$ and $0\text{x61CD}$ respectively. The result (in hex) of applying bitwise operator and to $x$ ...
0 0 votes
1 1 answer
592
592 views
rishu_darkshadow asked Nov 8, 2017
592 views
In C language, bitwise operation can be applied to which of the following operandsA. char B. int C. short, long ...
3 3 votes
1 1 answer
1.0k
1.0k views
dd asked Jun 27, 2017
1,045 views
#include <stdio.h int main() { unsigned int m = 0; m |= 0xA38; printf("%x\n",m|(m-1)); printf("%x\n",( (m|(m-1)) + 1 ) & m ); }Find the output ?
5 5 votes
4 answers 4 answers
3.6k
3.6k views
dd asked Dec 17, 2016
3,572 views
#include <stdio.h #define N 3 int main() { int array[N] = {1,2,3}; int i,j; for ( i=1; i<(1<<N); i++) { for( j=0; j<N; j++) { if((1<<j)&i) { printf("%d", array[j]); } } p...