Function to find the given number is a power of 2 or not?
Answer Posted / sudhesh
#include<stdio.h>
main()
{
int num,result;
printf("\nEnter the number:=");
scanf("%d",&num);
if (result=num&(num-1))
printf("No\n");
else
printf("Yes\n");
}
| Is This Answer Correct ? | 1 Yes | 3 No |
Post New Answer View All Answers
How can I write data files which can be read on other machines with different word size, byte order, or floating point formats?
What is c value paradox explain?
What is a MAC Address?
What are the string functions? List some string functions available in c.
How can you determine the size of an allocated portion of memory?
Write a program to swap two numbers without using a temporary variable?
What is a structure in c language. how to initialise a structure in c?
Write a code of a general series where the next element is the sum of last k terms.
write a programming in c to find the sum of all elements in an array through function.
Why dont c comments nest?
Stimulate calculator using Switch-case-default statement for two numbers
Which is more efficient, a switch statement or an if else chain?
What is the difference between union and structure in c?
write a program to concatenation the string using switch case?
What is the explanation for modular programming?