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

what is the role you expect in software industry?

1643


The process of repeatedly running a set of computer instructions until some condition is specifed a) condition b) sequential condition c) global d) iteration

617


What is typedef struct in c?

573


c language interview questions & answer

1447


How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same

643






Write the program with at least two functions to solve the following problem. The members of the board of a small university are considering voting for a pay increase for their 10 faculty members. They are considering a pay increase of 8%. Write a program that will prompt for and accept the current salary for each of the faculty members, then calculate and display their individual pay increases. At the end of the program, print the total faculty payroll before and after the pay increase, and the total pay increase involved.

2636


code for find determinent of amatrix

1501


Explain how do you use a pointer to a function?

628


What is a node in c?

539


what will be maximum number of comparisons when number of elements are given?

1395


Can we use any name in place of argv and argc as command line arguments?

600


How many parameters should a function have?

653


How is pointer initialized in c?

573


What are header files and explain what are its uses in c programming?

595


What is use of pointer?

575