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
How to compare array with pointer in c?
Hai,I have done with my bachelor of commerce and planing to ms,please suggest me how to convince vo for shifting from commerce to computers. Visa on 8 DEC 2014 Npu university
What is the code for 3 questions and answer check in VisualBasic.Net?
What is the use of #define preprocessor in c?
Explain built-in function?
What is the scope of an external variable in c?
What is pointer in c?
Write a program to check whether a number is prime or not using c?
Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]
What are the different types of objects used in c?
What are static variables in c?
Explain what does the function toupper() do?
What is a program?
How can I make it pause before closing the program output window?
how to count no of words,characters,lines in a paragraph.