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
What is the meaning of 2d in c?
What is the symbol indicated the c-preprocessor?
Why do we use c for the speed of light?
What is the difference between exit() and _exit() function in c?
Why is c called a mid-level programming language?
How can I write a function analogous to scanf?
Explain the priority queues?
disply the following menu 1.Disply 2.Copy 3.Append; as per the menu do the file operations 4.Exit
How do I determine whether a character is numeric, alphabetic, and so on?
What is a null pointer in c?
what is bit rate & baud rate? plz give wave forms
Explain logical errors? Compare with syntax errors.
What does node * mean?
Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
If fflush wont work, what can I use to flush input?