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


Please Help Members By Posting Answers For Below Questions

Explain what are the __date__ and __time__ preprocessor commands?

595


What is openmp in c?

613


What is wrong with this statement? Myname = 'robin';

823


process by which one bit patten in to another by bit wise operation is? (a) masking, (b) pruning, (c) biting, (d) chopping,

1893


Write a program to check armstrong number in c?

636






What is formal argument?

653


What is c definition?

751


Write a code to generate divisors of an integer?

643


what is the format specifier for printing a pointer value?

617


Can we initialize extern variable in c?

635


Write a function which takes as parameters one regular expression(only ? and * are the special characters) and a string and returns whether the string matched the regular expression.

654


What are the different types of errors?

647


What does the c in ctime mean?

571


What is an array in c?

598


Explain what are global variables and explain how do you declare them?

644