Write a one line code to check if a number is a power of 2.
Example : 8 = 2^3 so 8 is a power of 2 , 9 is not a power of 2.
Hint : you need to know about Bitwise Operators.
What will be output of following c code?
#include<stdio.h>
int main()
{
int i=2,j=2;
while(i+1?--i:j++)
printf("%d",i);
return 0;
}
Friday, 8 February 2013
Comments by IntenseDebate
Posting anonymously.
6
2013-02-08T06:30:00-08:00
cvs
prgm|