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 type of questions arrive in interview over c programming?

1779


program to find out date after adding 31 days to a date in the month of febraury also consider the leap year

2858


What is the size of a union variable?

802


write a C program: To search a file any word which starts with ?a?. If the word following this ?a? starts with a vowel.Then replace this ?a? with ?a? with ?an?. redirect with the output onto an output file.The source file and destination file are specified by the user int the command line.

2662


What’s the special use of UNIONS?

883


On most computers additional memory that is accessed through an adapter of feature card along with a device driver program. a) user memory b) conventional memory c) expandedmemory d) area

925


Explain the difference between malloc() and calloc() in c?

815


Explain about the functions strcat() and strcmp()?

797


What is the Purpose of 'extern' keyword in a function declaration?

863


write a program to print data of 5 five students with structures?

1843


write a program to find out prime number using sieve case?

1867


how to write optimum code to divide a 50 digit number with a 25 digit number??

3013


What are register variables? What are the advantage of using register variables?

908


Where local variables are stored in c?

756


What is the difference between typedef struct and struct?

849