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 are the rules for the identifier?

891


What is scope of variable in c?

786


how to execute a program using if else condition and the output should enter number and the number is odd only...

1951


What is the general form of function in c?

806


Linked list is a Linear or non linear explain if linear how it working as a non linear data structures

1965


How many identifiers are there in c?

780


What is identifiers in c with examples?

896


Declare the structure which contains the following members and write in C list of all students who score more than 75 marks. Roll No, Name, Father Name, Age, City, Marks.

995


Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......

1975


What are the types of pointers?

793


What is cohesion and coupling in c?

803


What is the basic structure of c?

791


Tell us two differences between new () and malloc ()?

845


What are predefined functions in c?

789


What is table lookup in c?

850