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
Do string constants represent numerical values?
How is a null pointer different from a dangling pointer?
write a program to create a sparse matrix using dynamic memory allocation.
Why array is used in c?
What are the different types of linkage exist in c?
Why is it usually a bad idea to use gets()? Suggest a workaround.
What is #line?
How can I pad a string to a known length?
What do you mean by a sequential access file?
What are the keywords in c?
What is double pointer in c?
What is the use of a static variable in c?
any "C" function by default returns an a) int value b) float value c) char value d) a & b
What are the types of pointers in c?
How is = symbol different from == symbol in c programming?