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

How can I do graphics in c?

589


Describe the steps to insert data into a singly linked list.

620


What is extern keyword in c?

642


What is an endless loop?

798


What is dynamic dispatch in c++?

554






Multiply an Integer Number by 2 Without Using Multiplication Operator

318


What will be your course of action for a push operation?

664


What is the function of volatile in c language?

664


hi, which software companys will take,if d candidate's % is jst 55%?

1660


What is sizeof c?

607


Differentiate between Macro and ordinary definition.

728


Write a function stroverlap that takes (at least) two strings, and concatenates them, but does not duplicate any overlap. You only need to worry about overlaps between the end of the first string and the beginning of the second string. Examples: batman, manonthemoon = batmanonthemoon batmmamaman, mamamanonthemoon = batmmamamanonthemoon bat, man = batman batman, batman = batman batman, menonthemoon = batmanmenonthemoon

1735


What do you mean by invalid pointer arithmetic?

637


Write a programme using structure that create a record of students. The user allow to add a record and delete a record and also show the records in ascending order.

1620


Can an array be an Ivalue?

664