sahil


{ City } banglore
< Country > india
* Profession * fresher
User No # 15266
Total Questions Posted # 0
Total Answers Posted # 1

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 18
Users Marked my Answers as Wrong # 7
Questions / { sahil }
Questions Answers Category Views Company eMail




Answers / { sahil }

Question { nvidia, 40393 }

Function to find the given number is a power of 2 or not?


Answer

int ispwrof2(int num)
{
int temp = 0;
if(num <= 0)
return 0;
else if(num > 0)
{
while(num%2 == 0)
{
temp = num/2;
num = temp;

}

}
if(num == 1)
return 1;
else
return 0;
}

Is This Answer Correct ?    18 Yes 7 No