Function to find the given number is a power of 2 or not?
Answer Posted / sujan.t
/* 100% correct answer */
int n = 3;
boolean bool = true;
int reminder;
while (n >1)
{
reminder = n % 2;
if(reminder != 0)
{
bool = false;
break;
}
else
{
n = n / 2;
}
}
if (bool == true)
printf("The number is a power of two");
else
printf("The number is NOT A power of two");
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
What is pointer and structure in c?
What is string in c language?
What does 1f stand for?
Explain how do you sort filenames in a directory?
What Is The Difference Between Null And Void Pointer?
write a programe to accept any two number and check the following condition using goto state ment.if a>b,print a & find whether it is even or odd and then print.and a
a) Identify the following declarations. Ex. int i (integer variable) float a[l0](array of 10 real nos) int (*f())() void *f int (*f()) [] void *f int f[] [] [] char *(*f) () int (*f[]) [] float(*f) [] [] float **f int ******f
What is the heap in c?
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
Write a program to show the change in position of a cursor using c
What is I ++ in c programming?
What is c language & why it is used?
can any one provide me the notes of data structure for ignou cs-62 paper
What does c mean in standard form?
Which programming language is best for getting job 2020?