Given an unsigned integer, find if the number is power of 2?
Answer Posted / veerendra jonnalagadda
main()
{
int i;
printf("Enter Number :");
scanf("%d",&i);
if(i&(i-1))
printf("Not atwo power");
else
printf("Two 's Power");
}
| Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
Which are low level languages?
What is the use of bitwise operator?
Which is best book for data structures in c?
What is #define used for in c?
What is the use of ?
What do you mean by dynamic memory allocation in c?
Write a program to print "hello world" without using a semicolon?
Write a program to swap two numbers without using third variable?
Why #include is used in c language?
What is structure and union in c?
How do you initialize pointer variables?
What is the correct declaration of main?
find the output? void r(int a[],int c, int n) { if(c>n) { a[c]=a[c]+c; r(a,++c,n); r(a,++c,n); } } int main() { int i,a[5]={0}; r(a,0,5); for(i=0;i<5;i++) printf("\n %d",a[i]); getch(); }
What is signed and unsigned?
What is the significance of an algorithm to C programming?