Given an unsigned integer, find if the number is power of 2?
Answer Posted / asis bera
main()
{
unsigned int n;
printf("enter the number:\n");
scanf("%u",&n);
if(i&(i-1))
printf(" not power of two\n");
else
printf("power of two...\n");
}
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What is the difference between struct and typedef struct in c?
What is the right type to use for boolean values in c?
How many types of sorting are there in c?
How can I make sure that my program is the only one accessing a file?
What is meant by keywords in c?
Are pointers really faster than arrays?
What is the difference between mpi and openmp?
Discuss the function of conditional operator, size of operator and comma operator with examples.
Explain bitwise shift operators?
Why c is called top down?
Write a code to generate a series where the next element is the sum of last k terms.
Explain what does the format %10.2 mean when included in a printf statement?
void main(){ int a; a=1; while(a-->=1) while(a-->=0); printf("%d",a); }
What is the use of extern in c?
Can 'this' pointer by used in the constructor?