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 ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are called c variables?

812


write a c program in such a way that if we enter the today date the output should be next day's date.

1944


In a switch statement, explain what will happen if a break statement is omitted?

862


What are near, far and huge pointers?

870


How many header files are in c?

797


Why can’t we compare structures?

1071


Does c have an equivalent to pascals with statement?

802


What are the 32 keywords in c?

882


What is double pointer?

789


What is auto keyword in c?

991


Why pointers are used?

862


PROGRAM TO WRITE CONTENTS OF 1 FILE IN REVERSE TO ANOTHER FILE,PROGRAM TO COPY 1 FILE TO ANOTHER BY SPECIFYING FILE NAMES AS COMMAND LINE

1744


What are pointers really good for, anyway?

841


What is the difference between procedural and declarative language?

928


Is there any data type in c with variable size?

883