Function to find the given number is a power of 2 or not?
Answer Posted / abhinay
main()
{
int n,m;
do
{
m=n%2;
n=m;
}
while(n>1);
if(m==1)
{
Printf("Number is not a power of 2");
}
else
{
printf("Number is a power of 2");
}
}
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is the difference between union and structure in c?
How can a string be converted to a number?
What is the difference between declaring a variable by constant keyword and #define ing that variable?
How can I ensure that integer arithmetic doesnt overflow?
What would the following code segment printint k = 8;docout << "k = " << k << " ";while k++ < 5; a) 13 b) 5 c) 8 d) pointers
what value is returned to operating system after program execution?
Is there sort function in c?
Tell me about low level programming languages.
What are # preprocessor operator in c?
A c program to display count values from 0 to 100 and flash each digit for a secong.reset the counter after it reaches 100.use for loop,. pls guys hepl me.. :(
Why is python slower than c?
What is const keyword in c?
FORMATTED INPUT/OUTPUT functions are a) scanf() and printf() b) gets() and puts() c) getchar() and putchar() d) all the above
What is nested structure?
What is table lookup in c?